const $ = db.command.project await db.collection( 'chat' ).where({ _id: event.id }).field({ _id: true , chatReqUserId: true , chatResUserId: true , record: $.slice(-2) }).get() |
const $ = db.command.project await db.collection( 'chat' ).where({ _id: event.id }).field({ _id: true , chatReqUserId: true , chatResUserId: true ,
tags: $.slice(-2)
}).get() |
报错信息: Error: errCode: -404011 cloud function execution error | errMsg: cloud.callFunction:fail requestID 9e68d720-fa24-11e9-b2dd-525400e8849e, cloud function service error code -504002, error message 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 cloud.callFunction api;
两种方法都测试过了,返回了同样的报错信息,然后在command列表文档下也找不到project这个方法,不知道是否是该方法已被废除,求大佬帮忙,万分感谢
const $ = db.command.aggregate
db.collection('test').aggregate()
.project({
a: $.slice(['$a', 2]),
})
.end().then(res => {
console.log(res)
})
还真不行
let _ = db.command, $ = _.aggregate
db.collection('counters').aggregate().match({
_id: event.id
}).project({
_id:true,
chatReqUserId:true,
chatResUserId:true,
record: $.slice(['$record', -2]),
}).end()
请问大佬:1、请问为什么在相通环境下,相同代码段内 photos.aggregate().end() 报错501000 ? 而同时photos.where().get()运行正常反馈结果。错误信息及代码如下。 https://developers.weixin.qq.com/community/develop/doc/00068c62754460db469b27b175ac00