Can we apply lookup on different collections i.e.
A collection (on accountId field ) lookup B collection(on accountId field) lookup C collection (on trx field)
let me clarify this i want to make a lookup on
A(on accountId field) → B (on accountId field)
B(on trx field)->C (on trx field)
Is that possible in mongoDB to apply lookup in a same query on different collections as mentioned above?
Thanks in advance.
@Lauren_Schaefer this is not the requirement might be i was unable to define my question properly. my question is that we all know that we can join many collections based on a field. i just want to join Collection A to collection B (which is a piece of cake) the next tricky thing is that i want to add join on Collection C with Collection B in the same query is that possible to do so in mongodb?
1- Collection A joins Collection B joins Collection C (this is what we all know)
2- Collection A joins Collections B, Collection B joins Collection C (in the same query)
@Lauren_Schaefer you are using Collection B as parent collection for aggregation but there will be 5 more joins with Collection A so it should be at the top.
The joins are happening on the the fields you indicated in your original question:
A(on accountId field) → B (on accountId field)
B(on trx field)->C (on trx field)
I don’t think I fully understand what you are trying to do. Please provide sample documents for each collection as well as the output you are looking for.