Mac mongodb

版权声明:欢迎分享技术,转载请声明。更多技术见 blog.hongxi.org https://blog.csdn.net/javahongxi/article/details/79667216

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") }

 

阅读更多

扫码向博主提问

javahongxi

非学,无以致疑;非问,无以广识
  • 擅长领域:
  • Java
  • Dubbo
  • Redis
  • Spring
去开通我的Chat快问
想对作者说点什么?

博主推荐

换一批

没有更多推荐了,返回首页