How to create a auto incremented column in Documentdb

后端 未结 1 1422
庸人自扰
庸人自扰 2021-01-02 09:14

I want to create a document in azure documentdb with an auto-increment column.

Is this possible? If yes, please guide me.

Any help would be greatly appreciat

1条回答
  •  礼貌的吻别
    2021-01-02 09:34

    DocumentDB doesn't include auto-increment functionality out of the box.

    As Gaurav mentioned in Do we have Identity Column in DocumentDB, the id field is special in that if a value isn't provided by the application - DocumentDB will assign a GUID automatically.

    If you need the auto-increment functionality, one potential solution would be to store a counter as a document and leverage DocumentDB's triggers to populate your field and update the counter.

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