So, I have a database with a load of arrays in documents in it.
I want to find entire documents where my queries are an exact match for one or more array elements using $i
You can use different syntax than the one you're trying that achieves the same result but doesn't run into the limitation in SERVER-3544.
Use this syntax:
db.collection.find({ "unusual": {"$elemMatch":{"defindex":363,"_particleEffect":{"$in":[6,19]} }} })
This will match any document which has an array element with both 313 and either 6 or 19.
It also works with {$in:[]}
for both defindex and _particleEffect, as long as you intend to match any combination of the two lists.
db.collection.find({ "unusual": {"$elemMatch":{"defindex":{"$in":[313,363]},"_particleEffect":{"$in":[6,19]} }} })
Just try this (Tested)
{
"unusual": {
$all:[{
$elemMatch:{"defindex":313},
$elemMatch:{"_particleEffect":6}
}]
}
}
https://jira.mongodb.org/browse/SERVER-3544
Welp, did a LOT of digging and it looks like that answers my question. You cannot do $in $elemmatch at this time.