Mongodb 位置投影不能与mongo 4.4中的文字错误一起使用
我有一个使用旧版本的查询:Mongodb 位置投影不能与mongo 4.4中的文字错误一起使用,mongodb,mongoose,Mongodb,Mongoose,我有一个使用旧版本的查询: await this.model.findOne({ userEmail, 'environments.envId': envId },{ 'environments.$': envId }) 但是我在环境中遇到了错误。$。我在网上找不到与此错误相关的任何内容。对于$projections,您只能使用一个数字。以下代码将起作用: await this.model .findOne({ userEmail, 'enviro
await this.model.findOne({ userEmail, 'environments.envId': envId },{ 'environments.$': envId })
但是我在
环境中遇到了错误。$
。我在网上找不到与此错误相关的任何内容。对于$projections,您只能使用一个数字。以下代码将起作用:
await this.model
.findOne({
userEmail,
'environments.envId': envId
},
{
'environments.$': 1
})
更多信息请点击此处: