- Linux or Mac machine
- Docker installed & running
- Terminal Application
- Or simply use the Google Cloud Shell (free!)
git clone https://github.com/u1i/mongodb-getting-started
cd mongodb-getting-started
./run-mongo.sh
db
test
show databases
admin 0.000GB
config 0.000GB
local 0.000GB
use class01
switched to db class01
db.students.insert({"name": "Kelly", "email": "kellyml91@yahoo.com"})
db.students.insert({"name": "Jason", "email": "jdoerr@gmail.com"})
db.students.insert({"name": "Jason", "email": "jdoerr@gmail.com"}, "activities": ["basketball", "table tennis"])
db.getCollectionNames()
db.students.find()
{ "_id" : ObjectId("5f5c85f67eaad73223e85fc3"), "name" : "Kelly", "email" : "kellyml91@yahoo.com" }
{ "_id" : ObjectId("5f5c85f87eaad73223e85fc4"), "name" : "Jason", "email" : "jdoerr@gmail.com" }
db.students.find().pretty()
db.students.find({"name": "Jason"})
{ "_id" : ObjectId("5f5c85f87eaad73223e85fc4"), "name" : "Jason", "email" : "jdoerr@gmail.com" }
db.students.remove({"name": "Jason"})
db.students.remove({})