命令行
mongoimport -d mydb2 -c test --type json --file /home/example/person.json
代码文件
echo "
db.test.find({\$and:[{age:20},{sex:'男'}]}).sort({_id:1});
db.test.find({\$or:[{sex:'男'},{age:20}]}).sort({_id:1});
db.test.find({name:/^韩.*/}).sort({_id:1});
db.test.find({\$and:[{age:{\$gte:19}},{age:{\$lt:22}}]}).sort({_id:1});
db.test.find({\$or:[{age:{\$lt:19}},{age:{\$gt:21}}]}).sort({_id:1});
db.test.find({name:{\$not:/^韩.*/}}).sort({_id:1});
db.test.find({name:{\$not:/^韩.*/}}).count();
db.test.find({\$and:[{age:{\$gte:19}},{age:{\$lt:22}}]}).count();
"