升级Mongo驱动版本从3.8.1到4.6.1时遇到问题。

huangapple go评论70阅读模式
英文:

Getting issue Upgrading from Mongo driver version 3.8.1 to 4.6.1

问题

在将Mongo驱动程序版本从3.8.1升级到4.6.1后,我的现有查询中出现了以下错误:

"未识别的管道阶段名称:'$and'"

以前所有的聚合都是有效的。
Spring Boot版本 - 2.7.10
Java版本 - 11

如果我将版本从4.6.1还原到3.8.1,我会得到未定义的类错误。请帮助我解决这个问题。

英文:

After updating the mongo driver version from 3.8.1 to 4.6.1. I am getting below error in my existing queries

"Unrecognized pipeline stage name: '$and'"

All the aggregations were working Earlier.
Spring boot version - 2.7.10
Java version - 11

If I revert the version from 4.6.1 to 3.8.1, I get class not defined error. Pls help me in resolving this issue

答案1

得分: 0

问题出在匹配管道上,它添加了两次 "and",但在先前的版本中运行良好,但在使用新版本时出现问题。我修改了以下代码:
改用这个:

pipeline.addAll
英文:

The issue was with the Match Pipeline , it was adding and two times but it was working fine in previous version biut breaking when we were using the new verison. I modified the below code :
Instead of this

pipeline.add(and

Use this:

pipeline.addAll

huangapple
  • 本文由 发表于 2023年5月25日 16:03:29
  • 转载请务必保留本文链接:https://go.coder-hub.com/76330110.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定