云数据库中集合的名称是“sfzs_taocan”,这个集合种的记录有四个字段,分别是“_id”、“neirong”、“qiyongriqi”、“yuexiaofei”,该集合的数据权限是:所有用户可读,仅创建者可读写。现在的需求是,在小程序端只显示“yuexiaofei”字段,代码如下:
const db = wx.cloud.database();
db.collection('sfzs_taocan').field({
_id: false,
neirong: false,
qiyongriqi: false,
yuexiaofei: true
}).get()
.then(res => {//请求成功
console.log(res.data);
})
.catch(err => {//请求失败
console.log('请求失败', err)
});
执行后,出现错误提示:
请求失败 Error: errCode: -501007 invalid parameters | errMsg: [InvalidParameterValue.QueryProjection] Query projection entered in the request is illegal. Please check your request, but if the problem persists, contact us.
at success (WASubContext.js?t=wechat&s=1649332451606&v=2.23.2:2)
at Function.success (WAServiceMainContext.js:2)
at d (WAServiceMainContext.js:2)
at Object.success (WAServiceMainContext.js:2)
at a (WAServiceMainContext.js:2)
at WAServiceMainContext.js:2
at Mi (WAServiceMainContext.js:2)
at WAServiceMainContext.js:2
at VM9 asdebug.js:1
at C (VM9 asdebug.js:1)
各位大神,帮我看看,到底是什么问题。拜托了!
贴一下云函数的调用代码吧