天天看點

mongodb

mongodb啟動

mongo shell

localhost:~ javahongxi$ cd soft/mongodb-2.4.6/

localhost:mongodb-2.4.6 javahongxi$ bin/mongo

mongodb shell version: 2.4.6

connecting to: test

server has startup warnings:

wed dec 2 23:41:43.955 [initandlisten]

wed dec 2 23:41:43.956 [initandlisten] ** warning: soft rlimits too low. number of files is 256, should be at least 1000

x=200

200

x/5

40

math.sin(math.pi / 2)

1

new date("2015/12/2")

isodate("2015-12-01t16:00:00z")

"hello, world!".replace("world", "mongodb")

hello, mongodb!

function factorial(n) {} function factorial(n) {

... if (n <= 1) return 1;

... return n * factorial(n - 1);

... }

factorial(5)

120

db

test

post = {"title":"my blog post",

... "content":"here's my blog post.",

... "date":new date()}

{

"title" : "my blog post",

"content" : "here's my blog post.",

"date" : isodate("2015-12-02t15:58:37.322z")

}

db.blog.insert(post) db.blog.find()

{ "_id" : objectid("565f153e4540e61d1a0efcc5"), "title" : "my blog post", "content" : "here's my blog post.", "date" : isodate("2015-12-02t15:58:37.322z") }