Sunday, September 14, 2014

MongoDB Basic command

I studied mongoDB 
and This mongoDB structure is like json structure
and this has collection.
this is just start time ~ I don't know how deeply i shoud study this mongoDB
but I'm just curious about using it and be interested in getting information of this database

blow post is what i got from O'Reilly - MongoDB- The Definition Guide



switch database 
> use footer

show which db i use
> db

create, read, update, delete

javascript functions are available in mongoDB

make post data
> post = {"title":"good", 
... "content":"this is body",
... "date" : new Date()}
"title" : "good",
"content" : "this is body",
"date" : ISODate("2014-09-15T00:18:45.482Z")


i gonna insert this post to blog


> or

> post.comments = []

>{title:"good"}, post)
WriteResult({ "nMatched" : 1, "nUpserted" : 0, "nModified" : 1 })


show dbs = show databasenames
show collections = show collections in current database
show users = show users in current database
use <db name> = set current database to <db name>

No comments:

Post a Comment