Hey guys I am new to mongo and its different interfaces and I am facing a few difficulties. I have created a bsonobj and stored in a collection. I was able to query successfully using the DBClientCursor class returning a bsonobj. I was trying to extract the value of a field based on its key.
// This is how the BSONObj is being created.
BSONObjBuilder b;
b << "Id" << id
b << "Name" <<"Ben"
b << "Age" << age;
BSONObj o = b.obj();
connStr.insert(collection, o);
After querying and retrieving the bsonObj based on the id What would be the appropriate way to extract the corresponding value of the Key Age ?
Aucun commentaire:
Enregistrer un commentaire