1
0
mirror of https://github.com/ialley-workshop-open/uni-halo.git synced 2026-09-12 16:40:40 +08:00
Files
uni-halo/.agents/bak-skills/uniapp-cloud/examples/database/query.md
T
2026-08-31 07:58:23 +08:00

564 B

云数据库查询

官方文档

参考官方文档:https://doc.dcloud.net.cn/uniCloud/database.html

条件查询

const db = uniCloud.database()
const users = db.collection('users')

users.where({
  age: db.command.gt(18)
}).get().then(res => {
  console.log(res.data)
})

排序与分页

users.orderBy('createdAt', 'desc')
  .skip(0)
  .limit(10)
  .get()

字段筛选

users.field({
  name: true,
  age: true
}).get()

参考资源