This is Meal schema .I want to get object inside meal array by filtering meal.owner for specific user.
what will be the query? .
can anybody help me please.
This is Meal schema .I want to get object inside meal array by filtering meal.owner for specific user.
what will be the query? .
can anybody help me please.
Meal.find({'meal.owner':req.params.memberId})
I am very new in mognoDB . I just tried above query but it gives me all data .
Please help me .
Yes sir i am using mongoose.
const ObjectId = require('mongoose').Types.ObjectId;
Meal.find({'meal.owner': new ObjectId(req.params.memberId)});
Sir i tried this query but it still gives me all the data .please sir help me …