MongoDB Documente Data IDs

Can anyone explain, How to add an auto-increment id field like A001, U0002?

Hello @Nuwan_Tharuka_N_A ,

There are many ways one can achieve this programatically, I am sharing a blog below which uses MongoDB Atlas Triggers to achieve the same in MongoDB Atlas

You can update the function mentioned in Create Trigger as per your requirements and can test it according to your collection documents.

To learn more about Database Triggers, please go through below


1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.