Convert Bson to string - MongoDB/Javascript
10,997
You can use the tojson
function like so:
str = tojson(db.mycol.stats());
Comments
-
Tyzak almost 2 years
how do I convert a bson obj to a string? I read Convert MongoDB BsonDocument into a string but that's for c#. I'm using Javascript for Mongodb
It would be applied at something like this:
myvar = db.mycol.stats();