Answer the question
In order to leave comments, you need to log in
What is the correct index for the specified collection structure in MongoDB?
There is a collection of objects, an approximate structure:
{
"a": unix timestamp,
"b" : string,
"c": usefull data ..
}
(a >= t1 && a <= t2) && (b in [b1, b2, b3, ..., bN]
Answer the question
In order to leave comments, you need to log in
this question is best answered by explain : https://docs.mongodb.com/manual/reference/operator...
depends on how many records are left to iterate after filtering on "a"
depends on how many unique rows " b"
in short, build an index on "a" and on "b" and see which one is greater/less
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question