MongoDB连接

时间:2018-10-21 17:35:57

标签: node.js mongodb

我是第一次尝试MongoDB,但我很难继续前进。 太简短了,我必须使两个终端之间的连接也继续我的课程。

第一个终端也是使用命令

启动MongoDB。
mongod.exe "C:\Program Files\MongoDB\Server\4.0\bin\mongod.exe" --dbpath="c:\data\db"

此终端显示一些警告?

2018-10-21T19:40:39.673+0200 I CONTROL  [initandlisten] ** WARNING: Access control is not enabled for the database.
2018-10-21T19:40:39.673+0200 I CONTROL  [initandlisten] **          Read and write access to data and configuration is unrestricted.
2018-10-21T19:40:39.674+0200 I CONTROL  [initandlisten]
2018-10-21T19:40:39.674+0200 I CONTROL  [initandlisten] ** WARNING: This server is bound to localhost.
2018-10-21T19:40:39.674+0200 I CONTROL  [initandlisten] **          Remote systems will be unable to connect to this server.
2018-10-21T19:40:39.674+0200 I CONTROL  [initandlisten] **          Start the server with --bind_ip <address> to specify which IP
2018-10-21T19:40:39.674+0200 I CONTROL  [initandlisten] **          addresses it should serve responses from, or with --bind_ip_all to
2018-10-21T19:40:39.674+0200 I CONTROL  [initandlisten] **          bind to all interfaces. If this behavior is desired, start the
2018-10-21T19:40:39.675+0200 I CONTROL  [initandlisten] **          server with --bind_ip 127.0.0.1 to disable this warning. 

第二个终端用于连接MongoDB:

"C:\Program Files\MongoDB\Server\4.0\bin\mongo.exe" 

执行该命令后,第一个终端应该收到类似正确建立的连接的信息?但这不是

这是第二个终端显示的内容,我也似乎是错误或无效的设置?

C:\>"C:\Program Files\MongoDB\Server\4.0\bin\mongo.exe"
MongoDB shell version v4.0.3
connecting to: mongodb://127.0.0.1:27017
Implicit session: session { "id" : UUID("ac2e6d2e-08a7-4305-ab8b-66a0f1f8f786") }
MongoDB server version: 4.0.3
Server has startup warnings:
2018-10-21T14:40:00.063+0200 I CONTROL  [initandlisten]
2018-10-21T14:40:00.064+0200 I CONTROL  [initandlisten] ** WARNING: Access control is not enabled for the database.
2018-10-21T14:40:00.064+0200 I CONTROL  [initandlisten] **          Read and write access to data and configuration is unrestricted.
2018-10-21T14:40:00.064+0200 I CONTROL  [initandlisten]
---
Enable MongoDB's free cloud-based monitoring service, which will then receive and display
metrics about your deployment (disk utilization, CPU, operation statistics, etc).

The monitoring data will be available on a MongoDB website with a unique URL accessible to you
and anyone you share the URL with. MongoDB may use this information to make product
improvements and to suggest MongoDB products and deployment options to you.

To enable free monitoring, run the following command: db.enableFreeMonitoring()
To permanently disable this reminder, run the following command: db.disableFreeMonitoring()
---

0 个答案:

没有答案