测试数据:
mongo --host 10.2.30.28 --port 27017 -umongo_rw -p"afsd23#zUNQbbO7oF" --authenticationDatabase=admin
use testdb;
db.testcol.insertMany([
{"_id":1,"name":"zhangsan1","timestamp": ISODate("2021-01-01T00:00:00Z")},
{"_id":2,"name":"zhangsan2","timestamp": ISODate("2021-02-01T00:00:00Z")},
{"_id":3,"name":"zhangsan3","timestamp": ISODate("2021-03-01T00:00:00Z")},
{"_id":4,"name":"zhangsan4","timestamp": ISODate("2021-04-01T00:00:00Z")},
{"_id":5,"name":"zhangsan5","timestamp": ISODate("2021-05-01T00:00:00Z")},
{"_id":6,"name":"zhangsan6","timestamp": ISODate("2022-01-01T00:00:00Z")},
{"_id":7,"name":"zhangsan7","timestamp": ISODate("2022-02-01T00:00:00Z")},
{"_id":8,"name":"zhangsan8","timestamp": ISODate("2022-03-01T00:00:00Z")},
{"_id":9,"name":"zhangsan9","timestamp": ISODate("2022-04-01T00:00:00Z")},
{"_id":10,"name":"zhangsan10","timestamp": ISODate("2022-05-01T00:00:00Z")}
])
mongoexport --host 10.2.30.28 --port 27017 -umongo_rw -p"afsd23#zUNQbbO7oF" --authenticationDatabase=admin --db testdb --collection testcol --query '{"name": "zhangsan1"}' --out testcol.json
mongoimport --host 10.2.30.28 --port 27017 -umongo_rw -p"afsd23#zUNQbbO7oF" --authenticationDatabase=admin --db testdb --collection testcol_10086 --file testcol.json --type json