DenzelOriginal post
Rank 1: Thread
I have a collection “notification” with an array field “readers” that contains user IDs of any user that reader’s the notification.
I want to query by listing all notifications that does not contain the current logged in user ID if that user ID exist in the readers.
Any help or suggestions?
Summary
Developers want to query a collection based on an array field and exclude notifications that contain the current user's ID in the readers array. Try this MongoDB query: `{ readers: { $nin: ["current_user_id"] } }` to filter out notifications with the current user's ID.