mongodb启动
bin/mongod ----- waiting for connections on port 27017 表示等待连接即可以通过客户端(Robomongo)或程序连接了
mongo shell
bin/mongo
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") }