index:
{
A: 1,
B: 2
}
{
A: 1,
C: 2
}
Query:
user.aggregate([{
$match: {
A: "house",
$or: [
{ B: "car" },
{ C: "boat" },
]
}
}
])
In order to check the $or
condition, will mongodb make use of both indexes?
EDITED:
According to the documentation on mongo's site, multiple single field can indexes can be used in the same query. However, in my question, both indexes are compound indexes.