Home > database >  Mongo cross-database create a view, is supported?
Mongo cross-database create a view, is supported?

Time:09-22

Recent projects assigned to the source data and processing data in several different database, create multiple source is not appropriate, also can ask across the library to create map view, or may be in trouble,

CodePudding user response:

Top ahhh

CodePudding 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
  • Related