I have two collections - Tickets
and Users
. Where a user
can have one to many tickets
. The ticket collection is defined as follows
Ticket = {_id, ownerId, profile: {name}}
The ownerId is used to find all tickets that belong to a specific person. I need to write a query that gets me all users with no tickets.
How can i write this query without having to loop through all users, checking if the userID shows up in any Tickets?
Would a bidirectional storage cause me any performance problems ? For example, if i were to change my users
collection and add an array of tickets: [ticketID, ticketID2, ...]
?