mongodb的安装母上cmd 然后输入 C:\Windows\System32\cmd.exe

mongodb mongodb://172.26.226.17:2001

你绑定的ip地址和端口 连接成功后提示以下信息

db://172.26.226.171:20001
MongoDB shell version v4.4.2
connecting to: mongodb://172.26.226.171:20001/?compressors=disabled&gssapiServiceName=mongodb
Implicit session: session { "id" : UUID("a530785d-fd9e-4ee1-bf33-69fbab3161f0") }
MongoDB server version: 4.4.2
---
The server generated these startup warnings when booting:
        2021-01-16T18:11:32.028+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()
---

然后开始使用 你的数据库和索引 

然后开始查找和删除。

 

> use Farmzai_Dev
switched to db Farmzai_Dev
> db.Device_Data.find().limit(1)
{ "_id" : NumberLong(1047459), "Name" : "Air Pressure", "Value" : 101093, "Unit" : "Pa", "CollectTime" : ISODate("2019-11-11T09:16:04Z"), "TrueCollectTime" : null, "MeasurementId" : 4, "MeasurementTypeId" : 4, "DeviceId" : 10188, "DeviceTypeId" : 2, "Brand_Id" : 10008, "FarmId" : 412, "FarmRoomId" : 551, "Model_Id" : 10017, "OrgId" : 10163, "CreateTime" : ISODate("2019-11-11T09:52:30Z") }
> db.Device_Data.find({"CollectTime":{$gt:ISODate("2021-01-14 00:00:00"),$lte:ISODate("2021-01-15 23:59:59")}}).count()
12665
> db.Device_Data.remove({"CollectTime":{$gt:ISODate("2021-01-14 00:00:00"),$lte:ISODate("2021-01-15 23:59:59")}})
WriteResult({ "nRemoved" : 12665 })
> db.Device_Data.find({"CollectTime":{$gt:ISODate("2021-01-14 00:00:00"),$lte:ISODate("2021-01-15 23:59:59")}}).count()
0
>
>

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐