I have this struct in my collection:
{foo : 1, bar : 4, baz : {a : 1, b : 2 ,c : "fafofu"}}
How do I find "a" and "b" inside baz ?
It does not works db.my_collection.find({baz : {a : 1, b : 2});
I don't care about if "c" is "fafofu" or "cacocu" does not matters.
You can use .
to reach into the baz object.
db.my_collection.find({"baz.a" : 1, "baz.b" : 2});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With