global auto-incrementing field in MongoDb

后端 未结 1 1621
伪装坚强ぢ
伪装坚强ぢ 2021-01-28 06:18

Is there a way to create a globally auto-incrementing value in a collection?

Perforce has the concept of a changelist# that can be a powerful feature for stateless updat

相关标签:
1条回答
  • 2021-01-28 06:38

    The MongoDB docs have a listing for auto-incrementing fields. In general it is bad practice, but this could work for the functionality you seek.

    That stated, I have also seen people use "timestamps" for the last updated time. This may satisfy your requirements.

    Likewise, if this is a really key feature, you may want to look at Riak's MVCC which seems closest to what you want.

    0 讨论(0)
提交回复
热议问题