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

Fix mongodb compatibility - #add-release-notes #4114

Merged
merged 8 commits into from
Apr 10, 2022

Conversation

SelimEmre
Copy link
Contributor

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.

Thank you for your work.

Please take a look at the comments.

In addition, it would be better if it supported mongodb atlas. I mean support for mongodb:// and mongodb+srv://
@muratugureminoglu @SelimEmre

I'm confirming this PR because no need to be perfect and we'll need to release a new version soon.



mongocon() {
if [ -z "$MONGODB_USERNAME" ] && [ -z "$MONGODB_PASSWORD" ]; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Handling username and password is good. It would be better if there is single command instead of having 'run_mongo' and 'run_mongo_auth'. It decrease the code duplication

mongo --host $MONGODB_IP --authenticationDatabase admin $db --quiet --username $MONGODB_USERNAME --password $MONGODB_PASSWORD --eval "$@"
}

mongo_backup(){
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

backup is a good idea

echo "The backup is not completed so it does not continue."
echo "Please check credentials are correct and you've write permission to current directory: `pwd` "
echo "If it's a permission issue, you may need to run this command with sudo"
exit 1;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added this case. If backup is not successful, let's stop the process. Don't get risk.

run_mongo_auth() {
db=$1
shift
mongo --host $MONGODB_IP --authenticationDatabase admin $db --quiet --username $MONGODB_USERNAME --password $MONGODB_PASSWORD --eval "$@"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mongo is deprecated. Let's start to use mongosh

}

#check if mongodb IP address is set
if [ -z "$MONGODB_IP" ]; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added this check

fi

#check if mongodb client tools is available
if ! [ -x "$(command -v mongo)" ]; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added this check

@sonarcloud
Copy link

sonarcloud bot commented Apr 10, 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 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@mekya mekya changed the title Feature/mongodb backward compatible Fix mongodb compatibility - #add-release-notes Apr 10, 2022
@mekya mekya merged commit 76b5cb8 into master Apr 10, 2022
@mekya mekya deleted the feature/mongodb-backward-compatible branch April 10, 2022 09:29
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.

None yet

2 participants