Query multiple collections.

250 views
Skip to first unread message

Hitesh Chavhan

unread,
May 31, 2017, 4:37:49 AM5/31/17
to mongodb-user
I need a method/way to query multiple collections in mongoDB.
Basically the query should be one but query is hitting two collections in same database.
One way may be we could create alias or pointer which points to two collection and I query the pointer. This concept is used in Elastic search.
I tried to find the solution but it always end at implementing the MR or Joins. But this is not required. Just querying on multiple collections.

Thanks for help in advance.

Rhys Campbell

unread,
May 31, 2017, 5:23:51 AM5/31/17
to mongodb-user
See the $lookup and $graphLookup operators

Pravin Dwiwedi

unread,
May 31, 2017, 2:23:22 PM5/31/17
to mongodb-user
there are multiple ways to do it--
1> Map Reduce https://docs.mongodb.com/manual/core/map-reduce/#MapReduce-Outputoptions
3> Using application programming, Python, Java, JS etc..

Hope above will work for you
Reply all
Reply to author
Forward
0 new messages