I am working on a project where there will be different kinds of accounts that use Auth0 for auth and authz. I want to have it so that an account will query my backend to get back documents that pertain to that user. The issue is I want to be able to have multiple accounts set to "own" each document where the number of owners could be 1 to 5.
I have come up with two options on what I could do and I'd like help figuring out which option makes more sense or maybe another one I had not thought of.
Option 1: Store a list of the objectIDs in Auth0 user data and then query in a loop for each of the documents till I fetch them all - major con as multiple DB calls causing delays when potentially 10-50 documents needed to fetch
Option 2: Add an array to each document that contains that document's owner(s) Auth0 user ID and then query Mongo for all documents which contain that user's ID in the field of the document. - should be efficient but wondering if the correct place for the data to be stored it's sorta user data.
Option 3: Something totally else?
$inoperator, just I would do it in SQL with the IN operator. In SQL, something like `SELECT * FROM documents WHERE objectID IN(id1, id2, id3, ...)'. Please clarify.