Using
printjson(db.getCollection('houses').find({}));
I get the output from the find object.
{ "_mongo" : connection to ***.***.***.***, "_db" : *****, "_collection" : ***.houses, "_ns" : "*****.houses", "_query" : { }, "_fields" : null, "_limit" : 0, "_skip" : 0, "_batchSize" : 0, "_options" : 4, "_cursor" : null, "_numReturned" : 0, "_special" : false, "help" : function () { print("find(<predicate>, <projection>) modifiers") print("\t.sort({...})") ........... }
if you use
db.getCollection('houses').find({}).forEach(printjson)
I get the desired result.
source share