# create database, if it's already exist then it will be returned
use mydb

#show databases
show dbs        

# drop database
db.dropDatabase()

# create collection
db.createCollection("mycollection")

# show collections
show collections        

# drop collection
db.mycollection.drop()

# Insert data (document):
db.post.insert({
    title: "My First Post",
    body: "Some silly text",
    tags: ["silly", "post", "first"]
})
# If the collection "post" doesn't exist, mongo will create it and then insert data.

# query
db.post.find()
db.post.find({'title': 'My First Post'})

# update
db.post.update({title:'My First Post'}, {$set:{'title', 'My First Post So far'}})

# remove
db.post.remove({title:'My First Post So Far'})
db.post.remove()      # remove all documents