-
Notifications
You must be signed in to change notification settings - Fork 636
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mongo unique index #3937
Mongo unique index #3937
Conversation
SonarCloud Quality Gate failed. |
Kudos, SonarCloud Quality Gate passed! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please check the comments.
MongoCollection broadcastCollection = database.getCollection("broadcast"); | ||
boolean isUnique= false; | ||
for(Object index : broadcastCollection.listIndexes()){ | ||
if(index.toString().contains("unique=true")){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please find the index name for streamId field and check if it's unique
Don't check every indexes has unique key or not.
} | ||
if(isUnique != true){ | ||
logger.info("Dropping stream ID index because it does not have unique label for db: {}", dbName); | ||
broadcastCollection.dropIndex("streamId_1"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't use hardcoded index name
This is being fixed in here #6718 |
#3847