i have collection called 'test' in that there is a document like:
{
"_id" : 1
"letters" : [
[ "A", "B" ],
[ "C", "D" ],
[ "A", "E", "B", "F" ]
]
}
if i search like this:
db.getCollection('test').find({"_id" : 1}, {"letters": ["A", "B"] })
then it will fetch the record.
{
"_id" : 1
"letters" : [
[ "A", "B" ],
[ "C", "D" ],
[ "A", "E", "B", "F" ]
]
}
if i search like this:
db.getCollection('test').find({"_id" : 1}, {"letters": ["B", "A"] })
it doesn't fetch the record
my requirment is if im give like this also (["B", "A"]), it have to fetch the document. Because the same letters are already present in the array.
i will try with $all operator but it doesn't work
db.getCollection('test').find({"_id" : 1}, {"letters": {$all: ["B", "A"]} })
now also it will not fetch the record
could anyone can please give the solution.