Yes, use getSiblingDB(). Let us add some documents to the database −
> use customer_tracker-990; switched to db customer_tracker-990 > db.demo1.insertOne({"Name":"Chris"}); { "acknowledged" : true, "insertedId" : ObjectId("5ea4697ca7e81adc6a0b3954") } > db.demo1.insertOne({"Name":"David"}); { "acknowledged" : true, "insertedId" : ObjectId("5ea46980a7e81adc6a0b3955") } > db.demo1.insertOne({"Name":"Bob"}); { "acknowledged" : true, "insertedId" : ObjectId("5ea46984a7e81adc6a0b3956") }
Display all documents from a collection with the help of find() method −
> db.getSiblingDB("customer_tracker-990").demo1.find();
This will produce the following output −
{ "_id" : ObjectId("5ea4697ca7e81adc6a0b3954"), "Name" : "Chris" } { "_id" : ObjectId("5ea46980a7e81adc6a0b3955"), "Name" : "David" } { "_id" : ObjectId("5ea46984a7e81adc6a0b3956"), "Name" : "Bob" }