Mongodb, One-to-Many, Embedded Document Problem

  mongodb, question

Excuse me, I have a user-“multiple addresses
At present, I put the address into the user collection with embedded document, but if I want to modify the address, what if the embedded document has no id? How can embedded documents achieve self-increasing id?

It is suggested to use uuid. It is more troublesome to manually maintain and write a self-increasing function by your own program if you want to add an id by yourself. It is not necessary to add an ID by yourself as long as it is unique.