Tutorial by Examples

find(query).projection(fields).cursorType(CursorType.TailableAwait).iterator(); That code applies to the MongoCollection class. CursorType is an enum and it has the following values: Tailable TailableAwait Corresponding to the old (<3.0) DBCursor addOption Bytes types: Bytes.QUERYOPTION...
To create a user dev with password password123 MongoClient mongo = new MongoClient("localhost", 27017); MongoDatabase db = mongo.getDatabase("testDB"); Map<String, Object> commandArguments = new BasicDBObject(); commandArguments.put("createUser", "dev&qu...
To get data from testcollection collection in testdb database where name=dev import org.bson.Document; import com.mongodb.BasicDBObject; import com.mongodb.MongoClient; import com.mongodb.ServerAddress; import com.mongodb.client.MongoCollection; import com.mongodb.client.MongoCursor; import c...

Page 1 of 1