We save objects that are shared between different users - think chat rooms. The objects have an array containing the usename ids of the participants. To find the rooms, we scan through the arrays finding the rooms that contain the username id of the user.
We need a way to index that array for faster querys, but Im also wondering if there’s a better way to do this that doesn’t require an array. Any ideas appreciated.
Other than that you could store the user list in the chat room object and the chat rooms in the users as well, that way it’s quick to find users in a room or rooms that a user is in.
What do your documents look like and what indexes do you have currently and what query are you running?