Skip to content
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

Closed
wants to merge 6 commits into from
Closed

Mongo unique index #3937

wants to merge 6 commits into from

Conversation

golgetahir
Copy link
Contributor

@sonarcloud
Copy link

sonarcloud bot commented Jan 31, 2022

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

76.2% 76.2% Coverage
0.0% 0.0% Duplication

@sonarcloud
Copy link

sonarcloud bot commented Mar 11, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 4 Code Smells

92.5% 92.5% Coverage
0.0% 0.0% Duplication

Copy link
Contributor

@mekya mekya left a 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")){
Copy link
Contributor

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");
Copy link
Contributor

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

@mekya
Copy link
Contributor

mekya commented Oct 14, 2024

This is being fixed in here #6718

@mekya mekya closed this Oct 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants