I have a performance issue that I can’t ignore.
I have a collection with 1000 document. This collection will not grow so the number is stable.
Each document weight 1kb. A single document has one array of subdocument and some other properties.
What I do is:
var result = db.collection("A") .Aggregate() .Match(Builders<T>.Filter.Eq("<ArrayName>.<PropertyName>", "name")) .ToList();
The result of the query operation in MongoDbCompass is 1ms for 200 document and its super ok.
The result of the ToList() of the documents is 10 seconds.
This happen even with property not inside an array.
What can I do ?
I have indexes in place for the properties I need to search for.
Also this result are from localhost:27017, so all in local.
I tested with the FindSync() and FindAsync() and I get the same results.
I tried .Skip(n) and Limit(n + 20) and the performance for 20 documents are 1.5 second. A lot.