Mongodb – duplicate key error index MongoDB

duplicationindexmongodb

I have rocket.chat server connected to LDAP.
When one of users try logging to their account he get logged to someone other account, it's probably because indexes. My logs look like this:

[34mI20161126-12:07:28.992(1) rocketchat_ldap rocketchat_ldap.js:341 [31mLDAP ➔ Search.error Search by id 31353036 returned 2 records
[34mI20161126-12:07:28.999(1) rocketchat_ldap rocketchat_ldap.js:780

[31mLDAPSync ➔ error { [MongoError: E11000 duplicate key error index:
rocketchat.users.$emails.address_1 dup key: { : "some@one.com" }]
name: 'MongoError', message: 'E11000 duplicate key error index:
rocketchat.users.$emails.address_1 dup key: { : "some@one.com" }',
driver: true, index: 0, code: 11000, errmsg: 'E11000 duplicate
key error index: rocketchat.users.$emails.address_1 dup key: { :
"some@one.com" }' }

Can I rebuild that indexes or something else to resolve this problem?

Best Answer

I am not familiar with Rocket.Chat.

Will dare to suggest to check that MongoDB collection's indexes with db.collectionName.getIndexes() and see if there is an index with the email address field as unique index. If so, then, drop it with db.collectionName.dropIndex("indexName").