A few things:
printjson(db.getMongo().getDBs());
var db = db.getSiblingDB('database');
var out = db.col.findOne();
printjson(out);
You probably won't see the output you want unless you use printjson
. Also .getSiblingDB()
returns the database object, so you need to "set" the variable.
Finally, "always" use var
to avoid the REPL "evaluating" each line. Which is also what you likely do not want.