Vote count:
0
I have a MongoDB collection of "departments" and each department has a sub-collection of "tickets". In the old MySQL-based system, we assigned a number to each ticket (per department) by counting existing records and adding one.
This gives each department a human-readable numbering system to identify tickets: 1, 2, 3, etc.
However, in Mongo, auto increment fields like this aren't used and I'm finding that because operations may be async (using Mongoose in a NodeJS app), counting existing records may not be trustworthy (same with incrementing a counter on the department collection)
I've spent time looking for a solution but am finding it difficult to sort out unrelated topics.
Is there any trusted way to make a sequential number system that relies on a custom query?
Sequentially numbering MongoDB subdocuments
Aucun commentaire:
Enregistrer un commentaire