I am now in a situation where I would like to run this command in the mongo shell and I can’t.
db.getSiblingDB("$external").runCommand({createUser: “C=US,ST=New York,L=New York City,O=MongoDB,OU=University2,CN=M310 Client”, roles: [{role: ‘root’, db:‘admin’}])
At this point I have tried two ways to start mongod on my three servers.
1st)
mongod --replSet TO_BE_SECURED --dbpath ./M310-HW-1.3/r0 --logpath ./M310-HW-1.3/r0/mongodb.log --port 31130 --fork --sslMode requireSSL --clusterAuthMode x509 --sslPEMKeyFile ./shared/certs/server.pem --sslCAFile ./shared/certs/ca.pem
2nd)
mongod --replSet TO_BE_SECURED --dbpath ./M310-HW-1.3/r0 --logpath ./M310-HW-1.3/r0/mongodb.log --port 31130 --fork
Both of those two method seemingly work to start the servers, but neither looks good at the end for what I want.
If I use the first way, then I am able to connect with the mongo shell, using this command:
mongo --host “TO_BE_SECURED/database.m310.mongodb.university:31130” --ssl --sslPEMKeyFile ./shared/certs/client.pem --sslCAFile ./shared/certs/ca.pem
If I use the second way, I am able to connect with the mongo shell, using this command:
mongo --host “TO_BE_SECURED/database.m310.mongodb.university:31130”
But in both case, I can’t run the above command:
db.getSiblingDB("$external").runCommand…
If someone can tell me what I am missing that would be great.