w3cschool通过本文主要向大家介绍了微信小程序云开发API 指定返回结果中记录需返回的字段等相关知识,希望对您有所帮助,也希望大家支持linkedu.com www.linkedu.com
微信小程序云开发API 指定返回结果中记录需返回的字段
由 Carrie 创建, 最后一次修改 2018-11-09 function field(definition: object): Collection | Query | Document方法接受一个必填字段用于指定需返回的字段
示例代码
返回 description, done 和 progress 三个字段:
const db = wx.cloud.database()
db.collection('todos').field({
description: true,
done: true,
progress: true
})
.get()
.then(console.log)
.catch(console.error)