Let's say I have a schema as
var TempSchema = new Schema({
location: Schema.Types.Mixed
});
location will store a json object
now I want to search by a property inside this json object field, can I use following query ?
Temp.find({location.country: {$in: ['US', 'CN', 'JP']}});
Yes you can do it using the dot notation, just enclose it inside quotes:
Temp.find({"location.country": {$in: ['US', 'CN', 'JP']}}, function(err, data) { /* ... */});
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