Senior Frontend Engineer & Certified Neo4j Professional with 7 years of experience. Love to learn and build new things. When not coding, you can find me exploring new tech, games & books.
Though populate is not bad. It is optimised. But there is a another way. If you know about aggregation framework in mongodb then there is a $lookup option that you can add in pipeline. I am still learning about aggregation framework. I have read that $lookup is faster than populate. Try to find more about it
Just know one thing. That populate makes a second call to database. So in your case 4 populates = 4 calls.
Or, you can do a live test :p...run query with populate and check its performance then run query with $lookup pipeline and compare its performance. (mongodb has ways to check query performance)
I hope it helps you. All the best for your project :)
Senior Frontend Engineer & Certified Neo4j Professional with 7 years of experience. Love to learn and build new things. When not coding, you can find me exploring new tech, games & books.
Senior Frontend Engineer & Certified Neo4j Professional with 7 years of experience. Love to learn and build new things. When not coding, you can find me exploring new tech, games & books.
Though populate is not bad. It is optimised. But there is a another way. If you know about aggregation framework in mongodb then there is a
$lookup
option that you can add in pipeline. I am still learning about aggregation framework. I have read that $lookup is faster than populate. Try to find more about itJust know one thing. That populate makes a second call to database. So in your case 4 populates = 4 calls.
Or, you can do a live test :p...run query with populate and check its performance then run query with $lookup pipeline and compare its performance. (mongodb has ways to check query performance)
I hope it helps you. All the best for your project :)
$lookup cannot be sharded and so it limits your scaling, super annoying constraint because I loved this stage until I spotted that.
Okayy. thank you !! I didn't know that :)
I still have to learn more about sharding. Never tried it.
Thanks Paras for your quick response. It surely helps.
You are welcome sir !!