查询并排序
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}})

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-08
  • 2021-04-11
  • 2022-02-13
  • 2021-12-16
  • 2021-06-05
猜你喜欢
  • 2022-03-01
  • 2021-08-20
  • 2022-12-23
  • 2021-06-11
  • 2021-05-28
  • 2021-08-31
  • 2021-08-02
相关资源
相似解决方案