I have a collection of documents where each holds a "list" property.
This list is an array of unique objects (I generated an ObjectID for each of them). We will call them listElements.
Now. I need to update 1 or more elements in the same query. I DO NOT NEED INDEX ON THEM. With arrays, I can't update each of them with its own specific values, it would only work as updating all matches with the same operation.
I thought of converting the "list" from an array, into an object who's keys are the ObjectID values so I could do:
{ $set: { "list.23rwfsdgfsda.time":123, "list.GJHhjh34j2h.order": "ascending" } }
This is just a placeholder example, I know its 12 characters for the key :P
My issue revolves around the keys: 12 characters is WAY TOO MUCH. I guesstimate around 300 possible listElements for a given list (possibly more) so a 3 character 16 base or even 10 base value would do fine.
Now, how would one generate an unique-per-"list" key for each new listElement while avoiding having to use a counter? It really doesn't matter to me what the key names are as long as they are short and unique-per-"list".
P.S: I don't need index because I will never find all documents in a collection based on the list and/or its content.