Rajesh Soni
2018-03-05 11:40:25 UTC
This is related to join multiple collection using $lookup and filter using
$match
We have order product collection with following attribute:
orderProduct(base collection)
------------
_id,
productId,
qty,
retailerId,
supplierId
unitPrice
lineTotal
Product(dependent collection)
------------
_id,
productName
subCategoryId
Retailer(dependent collection)
------------
_id
retailerName
Supplier(dependent collection)
-------------
_id
supplierName
Now we need to have following joins and select attribute from both
dependent and base collection
orderProduct joins Product
orderProduct joins Retailer
orderProduct joins Supplier
Also need filter from both dependent and base collection.
*The basic issue with above setup is that orderProduct is growing
rapidly(current size is 90K) and $lookup is taking too much time. *Sorting/Limit/Skip
also needed here
Is there any elegant way to handle this?
Thanks in advance
$match
We have order product collection with following attribute:
orderProduct(base collection)
------------
_id,
productId,
qty,
retailerId,
supplierId
unitPrice
lineTotal
Product(dependent collection)
------------
_id,
productName
subCategoryId
Retailer(dependent collection)
------------
_id
retailerName
Supplier(dependent collection)
-------------
_id
supplierName
Now we need to have following joins and select attribute from both
dependent and base collection
orderProduct joins Product
orderProduct joins Retailer
orderProduct joins Supplier
Also need filter from both dependent and base collection.
*The basic issue with above setup is that orderProduct is growing
rapidly(current size is 90K) and $lookup is taking too much time. *Sorting/Limit/Skip
also needed here
Is there any elegant way to handle this?
Thanks in advance
--
You received this message because you are subscribed to the Google Groups "mongodb-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-dev+***@googlegroups.com.
To post to this group, send email to mongodb-***@googlegroups.com.
Visit this group at https://groups.google.com/group/mongodb-dev.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-dev/c6ff1429-7d21-4230-b30a-382d3d7fab69%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups "mongodb-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-dev+***@googlegroups.com.
To post to this group, send email to mongodb-***@googlegroups.com.
Visit this group at https://groups.google.com/group/mongodb-dev.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-dev/c6ff1429-7d21-4230-b30a-382d3d7fab69%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.