Novokhatskyi Oleksii
1 min readMay 4, 2020

--

Thanks for your response.

Of course there a possibility to create such aggregation pipeline which despite of network delays, multiple cursors, RAM limits (all of this in case of multiple queries), not optimized aggregation pipeline can work slower then several find().

And in some cases (for one collection as an example) there is no need to use aggregation.

In my article I’ve described situation when we need to perform $lookup (JOIN in SQL world) to get data from multiple collections in MongoDB.

In this case (if everyting else is the same. Example: indexes, network, hardware) I cannot imagine situation when aggregation (optimized and with no errors like over document size limit etc.) with pipeline (which “provides efficient data aggregation using native operations within MongoDB, and is the preferred method for data aggregation in MongoDB”, it’s from official MonogDB doc https://docs.mongodb.com/manual/aggregation) and $lookup stage performs worse than multiple (even asynchronous on javascript side) queries.

If you can provide an example — I’ll be happy to check.

--

--

Novokhatskyi Oleksii
Novokhatskyi Oleksii

Written by Novokhatskyi Oleksii

Software Engineer, Co-Founder of Purport (purportapp.com), Tech Read channel (t.me/technicalread)

No responses yet