CodePudding user response:
Top ahhhCodePudding user response:
You can use the db. GetSiblingDB () as an alternative to the use & lt; Database> Helper. This is particularly useful when writing scripts using the mongo shell where the use helper is not available. Consider the following sequence of operations:The db=db. GetSiblingDB (' users')
Db. Active. The count ()
https://docs.mongodb.com/manual/reference/method/db.getSiblingDB/index.html