I have searched and was not able to find a solution to this. The closest thing I found was
Object.bsonsize(db.test.findOne({type:"auto"}))
which is JavaScript not Java.
I have searched and was not able to find a solution to this. The closest thing I found was
Object.bsonsize(db.test.findOne({type:"auto"}))
which is JavaScript not Java.
I don't use the java client, but you should be able to use it to execute your raw JavaScript. Here's a link which suggests how:
How do I execute a MongoDB js script using the Java MongoDriver