MongoDB.live, free & fully virtual. June 9th - 10th. Register Now

How to query more than one collection with the condition(s)

Hi Friends,

I have a use case(POC) where I need to perform a query on two collections(bigger, many fields +4k fields in each collection)
How to fire JSON query on this…
I have SQL query, similar(the ![input2|519x133]( thesame query need to be fired)

the SQL query:
select t1.X, t1.Y_DT,t1.Z,t1.adj,t1.bjc,t1.jbc,t1.mnk,t2.adj1,t2.bjc1,t2.jbc1,t2.mnk1 from inpt1 t1, input2 t2 where t1.X = t2.X AND t1.Y_DT=t2.Y_DT AND t1.Z = t2.Z;

Similar mongodb query needed…

Plz find sample input collections(files)…
input2 input1

Hi @Murali_Muppireddy and welcome to the community forums.

Take a look at the Specify Multiple Join Conditions with $lookup section of the $lookup documentation for an example query.

1 Like

Hi @Doug_Duncan, great let me try out.

Thank you