I'm trying to create a new user but I get this error:
Unable to add the element, the value null for the field loginPublic already exists, it cannot be duplicated.
The thing is that this field was used several months ago and I've renamed it since (in my user schema). I couldn't find any reference to this field in my project neither in the mongo database.
I'm wondering if it's possible that some kind of caching is messing up, checking the existence of such field while it's not used in my schema anymore.
Any idea?
It was an index issue:
List: http://docs.mongodb.org/manual/tutorial/list-indexes/
Remove: http://docs.mongodb.org/manual/tutorial/remove-indexes/
db.user.getIndexes()
{
"v" : 1,
"key" : {
"loginPublic" : 1
},
"unique" : true,
"ns" : "ayolan-translation-development.user",
"name" : "loginPublic_1",
"background" : true,
"safe" : null
},
The index on the "deleted" (non-used anymore) field still exist:
db.user.dropIndex( "loginPublic_1" )
Thanks to JohnnyHK.