I’m a bit new to Meteor and NoSQL in general. I was curious what the best practice is for handling one-to-many data where I want to store a unique index such as an ID? In this case is it better to create multiple collections to keep the unique IDs separate, or come up with some kind of unique index name based on the parent object and the unique id I want to track?
For example, let’s say I had a site to manage garage sales and each garage sale has a collection of items that I want to uniquely number. Each item only belongs to one garage sale and no two items can have the same item number. However other garage sales can have items using the same numbers.
I want to use a unique index to make sure that concurrent inserts can’t create the same unique item number, but how do I do this so that I can uniquely index based on some parent? Is a per-garage sale item collection the best way to go, or is there some way to create a unique index that include the parent item reference?