Node.js 不支持的投影选项:$concat On Azure CosmosDb
我已经在本地主机上编写了Mongoose查询,它工作正常,但在Azure CosmosDb上部署时,我面临着错误 “消息”:“{状态:500,消息:'Unsupported projection option:$concat'Node.js 不支持的投影选项:$concat On Azure CosmosDb,node.js,azure,mongoose,deployment,azure-cosmosdb,Node.js,Azure,Mongoose,Deployment,Azure Cosmosdb,我已经在本地主机上编写了Mongoose查询,它工作正常,但在Azure CosmosDb上部署时,我面临着错误 “消息”:“{状态:500,消息:'Unsupported projection option:$concat' User是正在使用的users表的模型。在架构中定义了Azure cosmos Db-->YourDb-->(在设置部分下)预览功能-->启用前2个选项 1.已启用MongoDB聚合管道 2.启用MongoDB 3.4线协议(版本5) User.aggregat
User是正在使用的users表的模型。在架构中定义了Azure cosmos Db-->YourDb-->(在设置部分下)预览功能-->启用前2个选项 1.已启用MongoDB聚合管道 2.启用MongoDB 3.4线协议(版本5)
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
}
});
});
});