Azure cosmos在MongoDB查询管道中抛出$round错误
我正在使用Azure Cosmos MongoDB并存储API请求日志。我想知道每秒有多少个请求。所以我在时间戳的基础上对它们进行分组,时间戳除以1000,然后四舍五入0位小数 1593096483234至1593096483.234至1593096483 对上述分组提供的文件进行计数,然后根据计数按降序排序 质疑 尝试运行上述查询时出现此错误Azure cosmos在MongoDB查询管道中抛出$round错误,mongodb,azure-cosmosdb,azure-cosmosdb-mongoapi,Mongodb,Azure Cosmosdb,Azure Cosmosdb Mongoapi,我正在使用Azure Cosmos MongoDB并存储API请求日志。我想知道每秒有多少个请求。所以我在时间戳的基础上对它们进行分组,时间戳除以1000,然后四舍五入0位小数 1593096483234至1593096483.234至1593096483 对上述分组提供的文件进行计数,然后根据计数按降序排序 质疑 尝试运行上述查询时出现此错误 Unable to execute the selected commands Mongo Server error (MongoCommandExc
Unable to execute the selected commands
Mongo Server error (MongoCommandException): Command failed with error 168 (168): 'unknown operator: $round' on server <server address>
The full response is:
{
"ok" : 0.0,
"errmsg" : "unknown operator: $round",
"code" : NumberInt(168),
"codeName" : "168"
}
无法执行所选命令
Mongo服务器错误(MongoCommandException):命令失败,错误为168(168):“未知操作员:$round”位于服务器上
全部答复如下:
{
“ok”:0.0,
“errmsg”:“未知运算符:$round”,
“代码”:数字打印(168),
“代号”:“168”
}
它在使用罗盘的本地设备上工作得非常好,但在使用Robo3T的宇宙设备上却不行。我做错什么了吗?如中所述,$round
操作符是在MongoDB的4.2版中引入的
如中所述,目前Azure Cosmos DB针对MongoDB的API与MongoDB服务器版本3.6兼容
这就是为什么您的查询在本地MongoDB实例(我相信是4.2或更高版本)上有效,但在Azure Cosmos DB上失败的原因。如中所述,$round
操作符是在MongoDB的4.2版中引入的
如中所述,目前Azure Cosmos DB针对MongoDB的API与MongoDB服务器版本3.6兼容
这就是为什么您的查询在本地MongoDB实例(我相信是4.2或更高版本)上运行,但在Azure Cosmos DB上失败的原因
Unable to execute the selected commands
Mongo Server error (MongoCommandException): Command failed with error 168 (168): 'unknown operator: $round' on server <server address>
The full response is:
{
"ok" : 0.0,
"errmsg" : "unknown operator: $round",
"code" : NumberInt(168),
"codeName" : "168"
}