问题
I've found here https://stackoverflow.com/a/60052210/10116440 that we can use aggregation to count the number of documents in a query. Can I, in the same aggregation pipeline, count the number of documents and then create a document with autoIncrementId = totalNumberOfDocuments + 1
?
来源:https://stackoverflow.com/questions/60064892/can-mongodb-aggregation-be-used-to-create-auto-increment-id