When creating users mongo throws E11000 error (E11000 duplicate key error collection: invent.users index: photo_1 dup key: { photo: null }"). I don't have the photo key anymore and deleted documents from the collection. Now, once I create the first user, I cannot create the second one. But if I delete that only one, I will be able to sign a user - but only 1 again.
So I'm wondering if there is a cache and a way to clear it because it seems that the problem comes with the photo key though I do not have it at all in my Model.
Someone says that Mongoose doesn't keep any cache, but what can it be that kept the field that doesn't exist anymore? I guess dropping the collection will resolve the problem, but this is not the best solution.
Thanks in advance!
I can't comment so I have to ask this way, have you set unique:true for this photo field? because if it is you need to go into your compass or atlas to delete the index for it. because mongo DB set an index for the unique key.