1.MongoDB Basics
How to Connect:
SQL
or
mongo -u mongoadmin -p 4dminPassw0rd --authenticationDatabase admin mongodb://tempdb1,tempdb2,tempdb3/readPreference=primaryPreferred
SQL
mongo "mongodb://user_name:[email protected]/db_name?authSource=admin"
Create db mydb:
Create a collection mycollection:
Show dbs
Drop database
SQL
durbok-replica:PRIMARY> db.dropDatabase()
{
"dropped" : "integration",
"ok" : 1,
"$clusterTime" : {
"clusterTime" : Timestamp(1669033752, 15),
"signature" : {
"hash" : BinData(0,"zT9H9L7Z2lwO5ogZfubTRqJQvxQ="),
"keyId" : NumberLong("7152889516020203523")
}
},
"operationTime" : Timestamp(1669033752, 15)
}