Answer the question
In order to leave comments, you need to log in
How to select all chats a user is a member of?
Tell me, please, what am I doing wrong? already tried everything. I have a CHAT object.
I'm trying to find all the chats that a particular user is a member of. those. I am looking for all chats that have an object in the chatMembers array whose property username = I need, but for some reason such a request does not give a result:
const chats = await Chat.find({ chatMembers: { $in: [{ username: req.username /* = "usver" */ }] } })
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question