Alec
My feedback
1 result found
-
10 votes
An error occurred while saving the comment Alec supported this idea ·
1 result found
Please sign in to leave feedback
Please sign in to leave feedback
No results.
Clear search results
To build on this, we have really bad performance doing a `countDocuments()` call on a covered index. It takes >5s on a collection with:
```
totalKeysExamined: 769298,
totalDocsExamined: 0,
```
I get that under the hood, the countDocuments() needs to scan the index, so will have O(n) time.
Since we want to call this count frequently (ideally every minute), it would be nice if this wasn't so bad. An acceptable workaround for us would be building a partial index with a filter that matches our countDocuments() filter, and then it would be really nice if we could get a estimatedCountDocuments() from the metadata of the index size, which is currently unavailable at the index level