Skip to content

Instantly share code, notes, and snippets.

@ryanvgates
Created November 12, 2019 04:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryanvgates/9b44b8893f9d697a236bef26064f0564 to your computer and use it in GitHub Desktop.
Save ryanvgates/9b44b8893f9d697a236bef26064f0564 to your computer and use it in GitHub Desktop.
Mongo Gotcha: use myDB from commandline successfully
..[ryan@host] - [~/Documents/git/repo] - [Mon Aug 26, 12:19]
..[$] <( (git)-[branch]-)> mongo --host=localhost --port=27017 --eval "db = db.getSiblingDB(‘myDB’); db.runCommand( { dbHash: 1 } )"
MongoDB shell version v4.0.3
connecting to: mongodb://localhost:27017/
WARNING: No implicit session: Logical Sessions are only supported on server versions 3.6 and greater.
Implicit session: dummy session
MongoDB server version: 3.2.15
WARNING: shell and server versions do not match
{
"host" : "fa34c6baf5a9",
"collections" : {
"3_20_1_1" : "b21dc0787d226ca7668f901d18f434f8",
"3_20_2_1" : "4f60ad3345ef546712ec3e72fc86f95b",
"3_5_3" : "da5097b8683c8f19c48c22abf63ebffa",
"3_5_5" : "4121a956b7160d49ca0ca8d6bf4b282a",
"4_20_3_2" : "573da6f1fac32422403a2e2a1c7b16e6",
"4_5_7" : "25951ce17fbc465187c7c6e075846686",
"5_20_4_3" : "4057fa6630cd40e474179ea5a9c4d87b",
"5_5_9" : "39cbf0af85f1e486cdbf8e7fc75e06e4"
},
"md5" : "bc73814f993c792129acd5ad3c5565a0",
"timeMillis" : 86,
"fromCache" : [ ],
"ok" : 1
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment