for each user I create, a unique number ID is assigned. Here is what I do:
let UserId = await userModel.countDocuments();
UserId++;
// then add the user
The problem is that I sometimes have the same UserId several times, for several different users.
I think the problem can come when several people create their account at the same time.
Thanks in advance for your answer!