Hi! I’m new to Fauna, and currently trying to wrap my head around a few concepts. The one that has bugging me the most, is what the best practice is when it comes to relationships. On a sample project, we have one collection with invoices, and another with users.
Now, the question is:
When looking up data, should I do that via an index which grabs the user_id
from the invoice, or should this be done via the ref of the user, which is stored on the user_ref
field?
The second approach seems safer, however then I have to use a function which converts the input from the query parameter to the ref of the user id, and then uses an index by refs.
This seems like an extra overhead, and extra operations, thus extra time and cost.
What’s the best-practice here?