DB json structure key as consecutive number

Hello everyone!

I have a mongodb collection where I need the json “key” as consecutive number

Screenshot 2022-07-27 at 15.30.58

I want “this” to be 1 2 3 4 … for every document; so document one has “1” in field “this”

Hope you can help me!

Hi @Fabian_Klaus ,

It sounds like you need some kind of a sequence ability with auto increment. If you use Atlas you can use:

The change you will need is to use the incremented value as a key of your document and not a specific value…