Hello and thanks for taking the time to help out. I am trying to find a mongoDB document that has an array.
The array is a list of IDs of users who have read the chat message.
I want to be able to find and/or count the docuemnts that do NOT contain the id of a specified user. That way I can tell who has or has not read the message.
Any pointers in the right direction are appreciated!
I know how to find a document that has an array that contains a value.... but I do not know how to find a document that has an array that does NOT contain a value.
let chatsUnread = await Chat.find({
chatRoom: rooms[i],
readMessage: { $all: [!userId] },
});
Thanks!