mongoose page query, search, fuzzy query

Fuzzy query the user according to the mobile phone number, and return the results in pages, the code is as follows

userModel.find({
    
    phone: {
    
    $regex: phone}}, {
    
    password: 0}).sort({
    
    _id: 1}).skip((page - 1) * pageSize).limit(pageSize).exec(function(error, data){
    
    
  if(err) return res.cc(error)
  res.cc('查询一页的记录', 200, {
    
    
    data,
    count,
  })
})```

Guess you like

Origin blog.csdn.net/cocogogogo/article/details/124365584