All Projects → zbjornson → MongoDBLink

zbjornson / MongoDBLink

Licence: MIT license
MongoDB driver for Mathematica

Programming Languages

Mathematica
289 projects
java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to MongoDBLink

Mongo Php Driver
MongoDB PHP driver
Stars: ✭ 737 (+3994.44%)
Mutual labels:  mongodb-driver
Erlmongo
Erlang driver for MongoDB with gridfs that works with maps and proplists
Stars: ✭ 90 (+400%)
Mutual labels:  mongodb-driver
Mongodb.entities
A data access library for MongoDB with an elegant api, LINQ support and built-in entity relationship management
Stars: ✭ 204 (+1033.33%)
Mutual labels:  mongodb-driver
Phalcon Mongodb Odm
MongoDB ODM for Phalcon framework for new mongodb php extension with query builder and rich functionality
Stars: ✭ 42 (+133.33%)
Mutual labels:  mongodb-driver
Avocado
Strongly-typed MongoDB driver for Rust
Stars: ✭ 70 (+288.89%)
Mutual labels:  mongodb-driver
Mongo Php Library
MongoDB PHP library
Stars: ✭ 1,391 (+7627.78%)
Mutual labels:  mongodb-driver
Mongo Rust Driver
The official MongoDB Rust Driver
Stars: ✭ 633 (+3416.67%)
Mutual labels:  mongodb-driver
mango
Use mongo-go-driver like mgo
Stars: ✭ 37 (+105.56%)
Mutual labels:  mongodb-driver
Lua Mongo
MongoDB Driver for Lua
Stars: ✭ 81 (+350%)
Mutual labels:  mongodb-driver
Mongo Perl Driver
Perl driver for the MongoDB
Stars: ✭ 203 (+1027.78%)
Mutual labels:  mongodb-driver
Mongoc.jl
MongoDB driver for the Julia Language
Stars: ✭ 46 (+155.56%)
Mutual labels:  mongodb-driver
Egg Mongo Native
MongoDB egg.js plugin using native driver.
Stars: ✭ 69 (+283.33%)
Mutual labels:  mongodb-driver
Mongojs
Node.js module that implements the offical mongo api
Stars: ✭ 1,782 (+9800%)
Mutual labels:  mongodb-driver
Mongo Cxx Driver
C++ Driver for MongoDB
Stars: ✭ 792 (+4300%)
Mutual labels:  mongodb-driver
Mongodb Plugin
MongoDB Plugin for Java
Stars: ✭ 236 (+1211.11%)
Mutual labels:  mongodb-driver
Alcinoe
Alcinoe Component Library For Delphi. Full opengl video player, WebRTC delphi wrapper, native ios/android TEdit, Improuved firemonkey controls, Firebase cloud messaging, Android/ios facebook sdk login, Json/Bson Parser, ImageMagick wrapper, MongoDb client And much more
Stars: ✭ 657 (+3550%)
Mutual labels:  mongodb-driver
Mongo.migration
On-the-fly migrations with MongoDB C# Driver
Stars: ✭ 99 (+450%)
Mutual labels:  mongodb-driver
ArchitectNow.ApiStarter
Sample ASP.NET Core 2 API Setup used by ArchitectNow for corresponding workshop presentations
Stars: ✭ 35 (+94.44%)
Mutual labels:  mongodb-driver
Mongo Swift Driver
The official MongoDB driver for Swift
Stars: ✭ 242 (+1244.44%)
Mutual labels:  mongodb-driver
Java Specialagent
Automatic instrumentation for 3rd-party libraries in Java applications with OpenTracing.
Stars: ✭ 156 (+766.67%)
Mutual labels:  mongodb-driver

⚠️ Note: Mathematica v11.3 and later has a built-in MongoLink package. This repository will likely no longer be updated, although it should continue to work.

MongoDBLink

MongoDB driver for Mathematica

A fast client for MongoDB, built on the official MongoDB java driver.

Quick setup

This will install the package in the $AddOnsDirectory. You may prefer $UserAddOnsDirectory instead.

tmp = URLSave["https://raw.githubusercontent.com/zbjornson/MongoDBLink/master/MongoDBLink.zip"];
dest = FileNameJoin[{$AddOnsDirectory, "Applications"}];
ExtractArchive[tmp, dest];
DeleteFile[tmp];
Print["Installed MongoDBLink to " <> dest]

Usage

New docs at http://zbjornson.github.io/MongoDBLink. These are incomplete and there are some interactivity bugs. When the docs are complete I will also distribute them with this package.

All symbols have usage text accessible with ?symbol, and Options[symbol]. Quick tutorial:

(* Load the package *)
<< MongoDBLink`

(* Connect to server. The server must already be running. *)
conn = OpenConnection[];
(* Also supported:
    OpenConnection["mongodb://..."]
    OpenConnection["host", port]
    OpenConnection["host", port, "username", "password", "database"]
*)

(* List databases. *)
DatabaseNames[conn]

(* Get a database *)
db = GetDatabase[conn, "name"]

(* List collections *)
CollectionNames[db]

(* Get a collection *)
coll = GetCollection[db, "name"]

(* Add some example data. The return value is the number of documents modified,
   which is 0 for an insert. *)
InsertDocument[coll, {"a" -> 1, "b" -> 2}]
(* Batch inserts: *)
docs = {"a" -> #, "b" -> 2 #} &/@ Range[5];
InsertDocument[coll, docs]

(* Fetch all documents *)
FindDocuments[coll]

(* Limit the fields returned *)
FindDocuments[coll, "Fields" -> {"b"}]

(* Paginate results *)
FindDocuments[coll, "Offset"->1, "Limit"->1]

(* Use query operators. Refer to the MongoDB docs for info on valid operators. *)
FindDocuments[coll, {"a" -> {"$gt" -> 2}}]

(* Some Wolfram Query operators are transparently executed on the database server: *)
coll[Total, "a"]
coll[Min, "a"]
coll[Max, "a"]
coll[Mean, "a"]

coll[;;3]
coll[2;;3, {"a"}]

(* Any operator will work, but any other than those listed above effectively
   fetch ALL data and convert it to a Dataset for calculation. *)

(* Find distinct values of a field *)
FindDistinct[coll, "b"]
FindDistinct[coll, "b", {"a" -> {"$gt" -> {2}}}]

(* Count documents *)
CountDocuments[coll]
CountDocuments[coll, {"b" -> 2}]

(* Delete documents *)
DeleteDocument[coll, {"a" -> 3}]

(* Update or "upsert" documents. Note that without $set, the entire document
   will be replaced with the new document. *)
UpdateDocument[coll, {"a" -> 4}, {"$set" -> {"a" -> -4}}]

(* When inserting documents with an _id property and making queries against _id
   fields, by default, values are automatically converted to ObjectIds. This can
   be disabled with the option "ConvertIds" -> False. *)

(* Create an ObjectId. Use this when you want to use an ObjectId for a field
   with a key name other than _id. Per above, _id fields are automatically
   converted by default. *)
oid = ObjectId[] (* random ObjectId *)
oid = ObjectId["5849bb55ee320f0abc87b06b"] (* from a valid string *)

(* Cleanup stuff *)
DropCollection[coll];
DropDatabase[db] (* or DropDatabase[conn, "name"] *)
CloseConnection[conn];
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].