MongoDB Drivers and Syntax table


MongoDB supporting multiple laungages which supports to connect via drivers. Will try covering diiferent luaguages and their syntax table to proceed with coding.

MongoDB Drivers

Driver Syntax Table

JavaScript Python PHP Ruby Java C++ C# Perl
[ ]
[]
array()
[]
BasicDBList
BSONObj

or

bson::bo
BsonArray
[ ]
{}
{}
new stdClass
{}
BasicDBObject
BSONObj
BsonDocument
{}
{ x : 1 }
{"x": 1}
array('x' => 1)
{'x' => 1}
BasicDBObjectBuilder.start().add("x", 1).get()
BSONObjBuilder().append("x", 1).obj();
BSON( "x" << 1 )
new BsonDocument("x", 1)
{ x : 1 }
connect("www.example.net")
MongoClient("www.example.net")
new MongoClient("mongodb://www.example.net")
MongoClient.new("www.example.net")
new MongoClient("www.example.net")
mongo::DBClientConnection conn;
conn.connect("www.example.net");
MongoClient("mongodb://www.example.net");
MongoDB::Client->new(host => 'www.example.net')
cursor.next()
cursor.next()
$cursor->getNext()
cursor.next
cursor.next()
cursor.next()
foreach (var document in cursor)
$cursor->next()
cursor.hasNext()
Does not exist
$cursor->hasNext()
cursor.has_next?
cursor.hasNext()
cursor.more()
 
$cursor->has_next()
collection.findOne()
collection.find_one()
$collection->findOne()
collection.find_one
collection.findOne()
connection.findOne(namespace, query)
collection.FindOne()
$collection->find_one()