If you just talk about the mongo shell:
var col = db.collection;
col.find()
And all other commands are perfectly valid. The same goes for the database:
var odb = db.getSiblingDB("other")
And now it odbworks with a "different" database.
odb.othercollection
Will work with "othercollection" in a "different" database, while it dbis still current.
All this is just JavaScript, so everything for the “object” is valid.
source
share