我已经在本地主机上对猫鼬查询进行了编码,并且可以正常运行,但是在Azure CosmosDb上进行部署时,我遇到了错误
“消息”:“ {状态:500,消息:'不支持的投影选项:$ concat'
User.aggregate()
.project({
fullname: { $concat: ['$first_name', ' ', '$last_name'] },
first_name: 1,
last_name: 1,
email: 1,
contact: 1,
image: 1,
role: 1,
isactive: 1
})
.match(condition).sort("fullname").skip(startIndex).limit(limit).exec((err, users)=>{
if (err) return next(err)
if(users == null)
return res.status(422).send({header:"User Error", content: "Unable to fetch Users"});
count = User.countDocuments({isactive: true},(err, count)=>{
if (err) return next(err)
if(count == null)
return res.status(422).send({header:"User Error", content: "User not found"});
// usersObject = users.map(o => o.toObject());
usersObject = users;
usersObject.forEach((user, index) => {
usersObject[index].image = '/public/image/user_images/' + user.image;
});
return res.send({
success:true,
msg: {
users: usersObject,
count
}
});
});
});
User是已使用的users表的模型。在架构中定义