Mongo: query on subdocs Mongo: query on subdocs mongoose mongoose

Mongo: query on subdocs


You are getting that error because there is no 'id' field defined for the 'tasks' subdocument. You might have meant 'user.tasks._id', which will return the ObjectId that MongoDB adds to its documents by default.