MongoDB has no auto increment column. API Maker gives one to every database : mark a number field with isAutoIncrementByAM and every row saved through the schema APIs gets the next number.
The counter of the field is increased by step. This is atomic : two servers saving at the same time get two different numbers.
When the result is not above start (a new counter, or a counter reset below start), API Maker reads the highest value the table already has : the next value is that maximum plus step, and at least start.
The value is written in the row. A value sent in the payload is replaced.
Start
Step
Counter
Highest in table
Next value
1000
5
1020
1025
1000
5
none
1100
1105
1000
5
none
empty table
1000
1
1
none
empty table
1
Rows inserted outside API Maker are picked up the next time the counter starts from scratch ; edit the counter on the Auto Increments page to realign it right away.
isAutoGenerateByAM on the same field wins, and isAutoIncrementByDB disables it : let the database count when it can.
A pull writes the counters of the branch into Redis when they are missing there ; a counter which exists on the server is never replaced by the one of Git.
A new environment therefore starts from the counters of the branch, and a running one keeps its own.