Display users differently depending on status


#1

Hi!

I have a chat where you can currently search and add/remove people from it.
I’m trying to figure out the best way to display which users are not in the chat and which users that are. I figured i’d just hide the ones who are already participating.

I’m currently fetching all users from the Meter users collection. Is it possible to write a custom helper to filter away all users that are found in Room.Participants so that only the ones not participating in the room are shown?


#2

I would guess that you want the MongoDB $nin operator: https://docs.mongodb.org/manual/reference/operator/query/nin/#op._S_nin. This is supported in minimongo, so you should be able to do something like

usersNotInChat: function() {
  return Users.find({_id: {$nin: arrayOfChatIds}});
}