$ mongoexport -h xx.xx.xx.xx \
--port=27017 \
--username=username \
--password='XXX' \
--authenticationDatabase=admin \
-d test \
-c T_Test \
-q '{"$and":[{"sendTime":{"$gt": new Date(1598889600000)}},{"sendTime":{"$lt": new Date(1601481600000)}}]}' \
--type json \
-o T_Test.json
$ mongoexport -h xx.xx.xx.xx --port=27017 --username=username --password='XXX' --authenticationDatabase=admin \
-d test \
-c T_Test \
-q '{"appId" : "500000009", sendTime: {$gt: ISODate("2021-10-01T00:00:00Z"),$lt: ISODate("2021-11-01T00:00:00Z")}}' \
-f _id,sourceId,senderId,appId,content,url,title,headImg,sendTime,pubId,acceptId,eid,later,dealTime,deal,oneKey,todoType,level \
--type csv \
-o T_Test.csv
$ mongo --host xx.xx.xx.xx:27017 --username=username --password='password' --authenticationDatabase=admin
> db.T_Test.count({"$and":[{"day":{"$gte": ISODate("2020-12-31T16:00:00.000Z")}},{"day":{"$lte": ISODate("2021-07-30T15:59:59.999Z")}}]})
参考
MongoDB find()方法:查询数据
http://c.biancheng.net/view/6555.html
MongoDB 条件操作符 gt、gte、lt、lte
https://blog.csdn.net/qq_43472877/article/details/110823207
网友评论