How do you implement an auto-incrementing primary ID in MongoDB?

后端 未结 7 1590
伪装坚强ぢ
伪装坚强ぢ 2020-12-05 12:11

Just like in MYSQL, I want an incrementing ID.

7条回答
  •  日久生厌
    2020-12-05 12:58

    While auto increment is not supported, you can easily implement your own little class for issuing incremental values.

    I needed that feature myself, so I wrote a small class in php. I wrote about it on my blog, here, take a look here

提交回复
热议问题