windows启动mongodb的常用命令

1.cmd进入mongo所在文件夹下的bin文件内

// 启动
PS D:\MongoDB\bin> ./mongo
MongoDB shell version v4.4.19
connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb
Implicit session: session { "id" : UUID("da525b1a-1fc4-4375-b58a-d17cbdd81c10") }
MongoDB server version: 4.4.19
---
The server generated these startup warnings when booting:
        2023-03-20T16:29:28.692+08:00: Access control is not enabled for the database. Read and write access to data and configuration is unrestricted
---
---
        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()
---
//查看所有数据库
> show dbs
admin   0.000GB
config  0.000GB
local   0.000GB
test    0.000GB
xinfa   0.000GB
//查看当前用户信息(无登录为空)
> show users
//进入'xinfa'的数据库
> use xinfa
switched to db xinfa
//查看数据库下的所有集合
> show collections
play_record
//查看集合内的数据
> db.play_record.find()
{ "_id" : ObjectId("64181e74f853411869cf501c"), "get_state" : 3, "obs_url" : "this is img_url", "device_code" : "230221PM03160002", "material_id" : 1, "advert_id" : 1, "advert_sn" : "1", "record_date" : "2022-03-20 15:25:16", "loacl_path" : "asdasdazx", "__v" : 0 }
{ "_id" : ObjectId("64181e74f853411869cf501d"), "get_state" : 1, "obs_url" : "", "device_code" : "230221PM03160002", "material_id" : 1, "advert_id" : 1, "advert_sn" : "1", "record_date" : "2022-03-20 16:14:20", "loacl_path" : "asdzxcasdqwe", "__v" : 0 }
>

image.png

你可能感兴趣的:(windows启动mongodb的常用命令)