Wednesday, 3 June 2020

I update my mongoose version to the latest one. Array populate not working correctly now.

node - v12.16.2 ,mongoose - ^5.9.17.Conversation.find({ participants:{$in:[req.body.userId]} }).populate({path:'participants'}) .then(conversations=>{ console.log(conversations[0].participants,' are conversations'); })It just populates the first user of conversation participants. I have tried a lot of combinations but it's always populating the first Id of the array. Any suggestions are welcome.

Submitted June 03, 2020 at 12:54PM by gp15now

No comments:

Post a Comment