Let’s suppose a collection has N documents and each document has an array field with M subdocuments.
For a query that uses a $elemMatch
on the field with the M subdocuments to filter and findMany documents of this collection, would the time complexity be equivalent to search a document of N X M documents?
The collection is targeted to have 1 billion documents and the subdocument field is targeted to have 100 documents.
This is equivalent to a collection of 100 billion documents.
Besides indexing the subdocument field, what are other scaling tactics that I can take?