Hi, what are the methods/drivers i can use to perform CRUD operations? Atm, i am only successful with the Create function, ie
DBObbject.put("field","value")
Common sense suggests that find() should stand for retrieve, but using it gives the following error
value find is not a member of com.mongodb.BasicDBObject
All and any help appreciated.
EDIT #1:
I also was able to perform retrieve, but I retrieved the whole document, and not a specific field.
var mongo = new Mongo()
var databaseName = mongo.getDB("DBName")
var collectionName = databaseName.getCollection("namecollection")
var testdbObject = new BasicDBObject()
testdbObject.put("userId", "5678")
var cursor = collectionName.find(testdbObject)
println(cursor.next())
EDIT #2: Field based retrieval. IMO, Can put inside loop and print all. Havent tried the loop thing.
var result = collectionName.findOne()
println(result.get("userId").toString)
Thanks.