-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
15af546
commit 2278cc9
Showing
6 changed files
with
55 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/bash | ||
|
||
# Replace the placeholders with your actual MongoDB connection details and credentials | ||
MONGO_HOST="localhost" | ||
MONGO_PORT="27017" | ||
#need these for later? | ||
ADMIN_USER="admin" | ||
ADMIN_PWD="admin" | ||
|
||
# MongoDB command to create a read-only user | ||
CREATE_USER_COMMAND="db.createUser({user: 'myTester', pwd: 'password', roles: [{role: 'read', db: 'test'}]})" | ||
|
||
mongosh --host $MONGO_HOST --port $MONGO_PORT --eval "use test; $CREATE_USER_COMMAND" | ||
|
||
#mongosh --eval "use test; db.createUser({user: 'myTester', pwd: 'password', roles: [{role: 'read', db: 'test'}]})" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/bash | ||
|
||
# Replace the placeholders with your actual MongoDB connection details | ||
MONGO_HOST="localhost" | ||
MONGO_PORT="27017" | ||
USER="myTester" | ||
PWD="password" | ||
|
||
# MongoDB command to attempt a write operation | ||
WRITE_COMMAND="db.testCollection.insert({x: 1})" | ||
|
||
# Attempt the write operation and capture the output | ||
mongosh --host $MONGO_HOST --port $MONGO_PORT -u $USER -p $PWD --eval "use test; $WRITE_COMMAND" | ||
|
||
#mongosh -u "myTester" -p "password" --authenticationMechanism SCRAM-SHA-256 --eval "use test; db.testCollection.insert({x: 1})" |