mirror of
https://github.com/ialley-workshop-open/uni-halo.git
synced 2026-09-13 00:50:40 +08:00
564 B
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()