org.springframework.dao.DataIntegrityViolationException: Cannot create index for '' in collection 'userMobileVerificationRequestVO' with keys '{ "userId" : 1 , "mobile" : -1}' and options '{ "name" : "userId_mobile_idx" , "unique" : true}'.; nested exception is com.mongodb.CommandFailureException: { "serverUsed" : "ip-10-0-3-31:27017" , "ok" : 0.0 , "errmsg" : "Index with pattern: { userId: 1, mobile: -1 } already exists with different options" , "code" : 85}

Searched on Google with the first line of a JAVA stack trace?

We can recommend more relevant solutions and speed up debugging when you paste your entire stack trace with the exception message. Try a sample exception.

Recommended solutions based on your search

Samebug tips

Do you know how to solve this issue? Write a tip to help other users and build your expert profile.

Solutions on the web

via Spring JIRA by sunny mittal, 1 year ago
Cannot create index for '' in collection 'userMobileVerificationRequestVO' with keys '{ "userId" : 1 , "mobile" : -1}' and options '{ "name" : "userId_mobile_idx" , "unique" : true}'.; nested exception is com.mongodb.CommandFailureException
via Spring JIRA by sunny mittal, 1 year ago
Cannot create index for '' in collection 'userMobileVerificationRequestVO' with keys '{ "userId" : 1 , "mobile" : -1}' and options '{ "name" : "userId_mobile_idx" , "unique" : true}'.; nested exception is com.mongodb.CommandFailureException
org.springframework.dao.DataIntegrityViolationException: Cannot create index for '' in collection 'userMobileVerificationRequestVO' with keys '{ "userId" : 1 , "mobile" : -1}' and options '{ "name" : "userId_mobile_idx" , "unique" : true}'.; nested exception is com.mongodb.CommandFailureException: { "serverUsed" : "ip-10-0-3-31:27017" , "ok" : 0.0 , "errmsg" : "Index with pattern: { userId: 1, mobile: -1 } already exists with different options" , "code" : 85}
at org.springframework.data.mongodb.core.index.MongoPersistentEntityIndexCreator.createIndex(MongoPersistentEntityIndexCreator.java:157)
at org.springframework.data.mongodb.core.index.MongoPersistentEntityIndexCreator.checkForAndCreateIndexes(MongoPersistentEntityIndexCreator.java:133)
at org.springframework.data.mongodb.core.index.MongoPersistentEntityIndexCreator.checkForIndexes(MongoPersistentEntityIndexCreator.java:125)

Users with the same issue

You are the first who have seen this exception. Write a tip to help other users and build your expert profile.

Write tip

Know the solutions? Share your knowledge to help other developers to debug faster.