1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| db.createCollection('bak_collection')
db.userrank.remove({age: 132});
db.userrank.find({rank: {$gt: 10}}); db.userrank.remove({rank: {$gt: 9},{"periodId" : "5ac34d7b8da8f115431fb167"}});
db.userrank.update({"rank": {$gt: 75}}, {$set: {"periodId": "5ac47a52442ab4eff15485cd"}}, false, true)
db.userrank.find().forEach(function(x){db.userrank_copy.insert(x)});
mongoexport --host <ip:port> --authenticationDatabase admin -u root -p <password> -d <database> -c <collection> -q '{rank:{$gt:8}, rankTime:1523462400, userId:{$lt:376}}' -o userrank.1523462400.json
mongoimport --host <host:port> --authenticationDatabase admin -u root -p <port> -d app -c userrank_test_only --file userrank.1523462400.json
|