0

I have a scenario in which I have multiple DBS and one DB maintaining a connection list of all DBS. Now I have to write a query in which I have to search in all DBS at the same time and get collaborated results from all DBS. Is there any way of using MongoDB to perform such a task??

example:- I have 10 DBS(list of all available DBS maintained in connections DB) and have to search the name Rahul in all DBS at the same time.

1 Answers1

0

What are you looking for? You should evaluate your schemas to have distinct models/values in each db.

Greg Price
  • 2,556
  • 1
  • 24
  • 33
  • i am looking for a way to tackle this scenario. For instance, let in all 10 DBS, let's have users collection in each db, so now i have to search name as rahul in all DBS. So I am looking for a way similar to $lookup(it works for multiple collections in one DB), I want to query multiple DBS having users collection in each DB and get the result where name = rahul. – Nikhil Manon Jul 21 '20 at 03:46
  • Ok I think you might want to look into creating a replica set https://docs.mongodb.com/manual/replication/ or here https://docs.mongodb.com/manual/tutorial/deploy-replica-set/ – Greg Price Jul 21 '20 at 03:51
  • If you need it quickly or don't have it yet check this out https://stackoverflow.com/questions/19474712/mongoose-and-multiple-database-in-single-node-js-project – Greg Price Jul 21 '20 at 18:11