描述:在数据库里执行“高级操作”,里面想测试lookup语句,按照示例写了pipeline语句,但是执行失败,报错显示$.pipeline() 的写法是错误的,不知道该怎么修正
db.collection('schedule')
.aggregate()
.lookup({
from:'teacher',
localField: 'teacher',
foreignField: '_id',
as: 'teacherList',
})
.lookup({
from: 'class',
let: {
schedule_teacher: '$teacher',
schedule_monday: '$monday',
},
pipeline: $.pipeline()
.match(
_.expr($.and([
$.eq(['$teacher', '$$schedule_teacher']),
$.eq(['$monday', '$$schedule_monday'])
]))
)
.project({
_id: 0
})
.done(),
as: 'classList',
})
.end()
RuntimeError: cannot read property 'pipeline' (from line 16, col 17 to line 16, col 25) 14 | schedule_monday: '$monday', 15 | }, > 16 | pipeline: $.pipeline() | ^^^^^^^^ 17 | .match( 18 | _.expr($.and([ 19 | $.eq(['$teacher', '$$schedule_teacher']),
把云函数的wx-server-sdk升级到最新版本,官方文档一言难尽
确定不支持了吗?
研究了半天的聚合写第一个函数就凉了?
云函数运行正常,看了其他帖子,应该是数据库的“高级操作”还不支持lookup的pipeline方式