collection.field

2020-08-28 11:45 更新

解释:指定返回结果中记录需返回的字段。

参数说明

该方法的传入参数为必填参数,参数类型为对象类型,用来指定需返回的字段。

代码示例

swan.cloud.init({
    env: 'envId'
});
const db = swan.cloud.database();
db.collection('users')
    .field({
        age: true,
        address: true,
        tags: true
    })
    .get()
    .then(res => {
        console.log(res);
    })
    .catch(err => {
        console.warn(err);
    });


以上内容是否对您有帮助:
在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号