It is recommended to use uuid. To implement auto-incrementing ID, you need to manually maintain and write an auto-incrementing function in your own program. It is also more troublesome. As long as it is unique, it does not have to be auto-incrementing
It is recommended to use uuid. To implement auto-incrementing ID, you need to manually maintain and write an auto-incrementing function in your own program. It is also more troublesome. As long as it is unique, it does not have to be auto-incrementing
There are two methods to implement self-increasing ID in mongodb:
counter collection
Use findAndModify()