I was wondering if the Java driver is equivalent to the Mongo JavaScript method for Object.bsonsize (doc)? For example, what is Java code to do the following:
bobk-mbp:~ bobk$ mongo MongoDB shell version: 2.0.4 connecting to: test PRIMARY> use devices; switched to db devices PRIMARY> Object.bsonsize( db.profiles.findOne( { _id: "REK_0001" } ) ); 186 PRIMARY> Object.bsonsize( db.profiles.findOne( { _id: "REK_0002" } ) ); 218 PRIMARY>
How to execute the same basic usage example with the MongoDB Java driver. This is not obvious through JavaDocs.
mongodb mongodb-java
Bob kuhar
source share