-
Notifications
You must be signed in to change notification settings - Fork 614
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
Conversation
feature/mongodb-backward-compatible
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.
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 |
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.
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(){ |
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.
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; |
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.
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 "$@" |
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.
mongo
is deprecated. Let's start to use mongosh
} | ||
|
||
#check if mongodb IP address is set | ||
if [ -z "$MONGODB_IP" ]; then |
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.
I've added this check
fi | ||
|
||
#check if mongodb client tools is available | ||
if ! [ -x "$(command -v mongo)" ]; then |
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.
I've added this check
Kudos, SonarCloud Quality Gate passed! |
#4027