落魄实习生
落魄实习生
  • 发布:2020-04-14 17:54
  • 更新:2020-05-09 00:11
  • 阅读:893

使用lookup时报错,说let只能用string,但官方文档不也是数组吗?

分类:uniCloud
return await db.collection('department').aggregate()  
            // 关联用户表  
            .lookup({  
                from: 'organization_user',  
                // localField: '_id',  
                // foreignField: 'department_id',  
                let: {  
                    ids: '$_id'  
                },  
                pipeline: $.pipeline()  
                    .match(_.expr($.and([  
                        $.eq(['$department_id', '$$ids'])  
                    ])))  
                    .done(),  
                as: 'user'  
            })  
            .end();

请求云函数错误: errCode: InternalServerError | errMsg: 云数据库系统错误 << arguments to $lookup must be strings, let: { ids: "$_id" } is type object

2020-04-14 17:54 负责人:无 分享
已邀请:
龙啸泽渊

龙啸泽渊

因为阿里云是3.4的mongodb。。。你这个写法是3.6之后才有的

该问题目前已经被锁定, 无法添加新回复