Friday, 26 May 2017

How to do nested find in mongoose?

I have a user model which has todolists field, in the todolists field I want to get the specific todolist by id. my query is like this:

 User.find({_id: user._id, _creator: user, todoList: todoList._id}, 'todoLists') // how do I query for todoList id here? I used _creator this on populate query. 

I haven't tested this yet because I am still modifying my Graphql schema and I am new in mongoose.I would really appreciate Links and suggestions. Help?



via i am newbie

No comments:

Post a Comment