查询以 李 开头的

 db.student.find({name:/^李/})

查询英文的 姓名

 db.student.find({name:/^[a-zA-Z]{2,10}$/})

 

分页

// db.student.find({}).limit(2)
skip  起始位置
db.student.find({}).skip(2).limit(2)

 

排序    sort  1 正序  2 倒序
db.student.find({}).sort({name:1}) 
db.student.find({}).sort({name:-1})).skip(2).limit(2)

排除重复记录
db.student.distinct("city").slice(0,5)

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-11-03
  • 2021-11-22
  • 2021-10-29
  • 2021-07-01
  • 2021-08-01
  • 2021-06-04
猜你喜欢
  • 2022-01-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-19
  • 2022-12-23
相关资源
相似解决方案