General question about aggregations

Hello Mongo Team,

Considering the complexity of an aggregations $graphLookup query that one may end up in some cases… and the given memory limitations… I am wondering whether using a script (javascript) would be more efficient or not in these cases.
I assume that the script could include of course queries and/or simple lookups. I also assume the presence of the same indexes in both cases.
I guess you as Mongo team, you 'll have made some tests around speed, memory consumption. Are there any general conclusions about this perspective?

Thanks in advance !


No doubt an interesting question, but not appropriate for this Forum. I would suggest that you post general questions such as this in the public MongoDB forums or on Stack Overflow.

Yes, makes sense… :slight_smile: … I just thought to ask here since the topic is related to a couple of “Labs”, and could be possibly useful.

Thanks for the clarifiction anyway !!


No problem. :slightly_smiling_face:

Students who are very involved in the course often think of questions that are related, but not directly relevant to the course materials. That’s good, but I can’t answer all those here.

If by more efficient, you mean faster, I would think that doing the work on the database (when you can) would be faster than doing it with any scripting language. It would also be more efficient on network bandwidth, because you wouldn’t have to send all the results to be processed to the application layer (or your microservice)