RoboMongo命令(版本:Robo 3T 1.1.1)
查询并排序
db.getCollection('working_history').find({"identification" : "76170178"}).sort({"pick_time":-1})
多条件查询
db.getCollection('working_history').find({"$and":[{"pick_time_str" : "2017-11-08-17-25-00-000-000-000"},{"identification":"76170178"}]})
"$in"可以指定不同类型的条件和值,如正在将用户的ID号迁移成用户名的过程中,要做到两者兼顾的查询:
db.users.find({"user_id":{"$in":[12345,"refactor"]}})
"$lt","$lte","$gt","$gte"分别对应<,<=,>,>=
如:查询age >=18 <=30
db.users.find({"age":{"$gte":18,"$lte":30}})
Feel free to contact me on professional issue.
liveinspring@hotmail.com