I'm using Mongoosewith NodeJS.
I have these two schemas:
var feedSchema = mongoose.Schema({
users: [{ type: Schema.Types.ObjectId, ref: 'User' }]
...
...
});
and
var userSchema = mongoose.Schema({
email: String,
...
...
});
I want to find all feeds that contains the user._id inside its users field.
I'm wondering if mongoose has something like this:
Feed
.find({
users : {
$has : [
user._id
]
}
})
.exec(function(err, retData) { /* SOMETHING */ });
I couldn't find anything like that in the docs.
Thanks!