Microsoft Windows [版本 6.1.7601]
版权所有 (c) 2009 Microsoft Corporation。保留所有权利。
C:\Users\Administrator>cd C:\MongoDB\Server\3.4\bin
C:\MongoDB\Server\3.4\bin>
C:\MongoDB\Server\3.4\bin>
C:\MongoDB\Server\3.4\bin>net start MongoDB
请求的服务已经启动。
请键入 NET HELPMSG 2182 以获得更多的帮助。
C:\MongoDB\Server\3.4\bin>mongo
MongoDB shell version v3.4.24
connecting to: mongodb://127.0.0.1:27017
MongoDB server version: 3.4.24
Server has startup warnings:
2023-08-05T17:12:10.060+0800 I CONTROL [initandlisten]
2023-08-05T17:12:10.060+0800 I CONTROL [initandlisten] ** WARNING: Access control is not enabled for the database.
2023-08-05T17:12:10.060+0800 I CONTROL [initandlisten] ** Read and write access to data and configuration is unrestricted.
2023-08-05T17:12:10.060+0800 I CONTROL [initandlisten]
2023-08-05T17:12:10.060+0800 I CONTROL [initandlisten] Hotfix KB2731284 or later update is not installed, will zero-out data files.
2023-08-05T17:12:10.060+0800 I CONTROL [initandlisten]
>
>
>
> use zengwefeng-db
switched to db zengwefeng-db
>
> db
zengwefeng-db
>
> db.user.insert(code:"005129", name:"zengwenfeng")
2023-08-05T17:20:55.615+0800 E QUERY [thread1] SyntaxError: missing ) after argument list @(shell):1:19
> db.user.insert({code:"005129", name:"zengwenfeng"})
WriteResult({ "nInserted" : 1 })
>
> db.user.find()
{ "_id" : ObjectId("64ce14a434d47045c9a7e72f"), "code" : "005129", "name" : "zengwenfeng" }
>
> db.shutdownServer()
shutdown command only works with the admin database; try 'use admin'
>
> use admin
switched to db admin
>
> db.shutdownServer()
2023-08-05T17:23:00.363+0800 I NETWORK [thread1] Socket recv() 远程主机强迫关闭了一个现有的连接。 127.0.0.1:27017
2023-08-05T17:23:00.381+0800 I NETWORK [thread1] SocketException: remote: (NONE):0 error: 9001 socket exception [RECV_ERROR] server [127.0.0.1:27017]
server should be down...
2023-08-05T17:23:00.444+0800 I NETWORK [thread1] trying reconnect to 127.0.0.1:27017 (127.0.0.1) failed
2023-08-05T17:23:05.445+0800 W NETWORK [thread1] Failed to connect to 127.0.0.1:27017 after 5000ms milliseconds, giving up.
2023-08-05T17:23:05.449+0800 I NETWORK [thread1] reconnect 127.0.0.1:27017 (127.0.0.1) failed failed
>
>
> exit
bye
C:\MongoDB\Server\3.4\bin>
C:\MongoDB\Server\3.4\bin>
C:\MongoDB\Server\3.4\bin>mongo
MongoDB shell version v3.4.24
connecting to: mongodb://127.0.0.1:27017
2023-08-05T17:24:51.875+0800 W NETWORK [thread1] Failed to connect to 127.0.0.1:27017 after 5000ms milliseconds, giving up.
2023-08-05T17:24:51.876+0800 E QUERY [thread1] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed :
connect@src/mongo/shell/mongo.js:240:13
@(connect):1:6
exception: connect failed
C:\MongoDB\Server\3.4\bin>net stop MongoDB
没有启动 MongoDB 服务。
请键入 NET HELPMSG 3521 以获得更多的帮助。
C:\MongoDB\Server\3.4\bin>net start MongoDB
MongoDB 服务正在启动 ..
MongoDB 服务已经启动成功。
C:\MongoDB\Server\3.4\bin>