C# GraphLookup Out of Memory

Hi,

I have a large set of documents (>1.000.000) and they are tree-like connected. Now I wanted to use graphlookup aggregation to find parents/children. However, if I set maxDepth above a certain value (e.g. 10) I get: MongoDB.Driver.MongoCommandException: ‘Command aggregate failed: $graphLookup reached maximum memory consumption.’

I already use .Aggregate(new AggregateOptions() { AllowDiskUse = true }) but this did not help. Any ideas? Or is it time to move to Neo4J or ArrangoDB now?

Cheers
Steffen

Hi @Steffen_Schutte,

We certainly hope you won’t move to any other database.

Unfortunately, the $graphLookup stage is not able to use disk for extending memory… Therefore it ignores allowDiskUse.

https://docs.mongodb.com/manual/reference/operator/aggregation/graphLookup/#memory

Perhaps you can run several queries to limit the amount it traverse.

Also consider trying a $facet with several $graphLookup stages (however, did not test if that would work)

Thanks
Pavel