This is my data:
{
"_id": 1,
"items": [
[{"name": "a"}, {"size": 2}, {"color": "red"}],
[{"name": "b"}, {"size": 4}, {"color": "blue"}],
[{"name": "c"}, {"size": 6}, {"color": "pink"}]
]
},
{
"_id": 2,
"items": [
[{"name": "a"}, {"size": 3}, {"color": "black"}],
[{"name": "e"}, {"size": 6}, {"color": "blue"}],
[{"name": "g"}, {"size": 9}, {"color": "pink"}]
]
}
And I need to do something like this:
db.foo.find({items.name: "a", items.color: "red"})
It's not working
db.foo.find({ items: {$all: ["name": "a"], ["color": "red"]}});Let me know if that works