9***@qq.com
9***@qq.com
  • 发布:2024-02-24 12:58
  • 更新:2024-02-24 12:58
  • 阅读:108

数据库查询报错:首个project方法内仅可使用白名单模式

分类:uniCloud

uni-id-users中的password字段是没权限阅读的,以下代码执行时报错首个project方法内仅可使用白名单模式

get(limitNum) {  
    var that = this;  
    db.collection('uni-id-users').aggregate()  
        .project({  
            _id: 1,  
            username: 1,  
            nickname: 1,  
            avatar_file: 1  
        })  
        .lookup({  
            from: "users-bind",  
            let: {  
                user_id: "$_id"  
            },  
            pipeline: $.pipeline().match(_.expr($.eq(['$user_id', '$$user_id']))).done(),  
            as: "user_bind_info"  
        })  
        .unwind({  
            path: "$user_bind_info",  
            preserveNullAndEmptyArrays: true  
        })  
        .lookup({  
            from: "employee",  
            let: {  
                emp_id: "$user_bind_info.emp_id"  
            },  
            pipeline: $.pipeline()  
                .match(_.expr($.eq(['$emp_id', '$$emp_id']))).done(),  
            as: "employee_info"  
        })  
        .end()  
        .then(res => {  
            console.log(res)  
        })  
        .catch(err => {  
            uni.hideLoading();  
            uni.stopPullDownRefresh();  
            uni.showToast({  
                title: err.message,  
                icon: "none"  
            });  
        });  
}
2024-02-24 12:58 负责人:无 分享
已邀请:

要回复问题请先登录注册