gpt4 book ai didi

java - 什么取代了 MongoDB AggregationOutput 类?

转载 作者:可可西里 更新时间:2023-11-01 10:00:54 25 4
gpt4 key购买 nike

所有方法都已被弃用,但我无法找到用于与 java 驱动程序聚合的替代类。

最佳答案

感谢 evachooly 的回答,这是要做的。
替换:

 AggregationOutput output = collection.aggregate(pipe);
for (DBObject obj : output.results()) {
//...
}

通过

  // this build of options is taken from the original method
// aggregate(pipe) to have same behaviour
AggregationOptions options = AggregationOptions.builder()
.outputMode(AggregationOptions.OutputMode.INLINE)
.build();

Cursor cursor = collection.aggregate(pipe,options);
while (cursor.hasNext() ) {
DBObject obj = cursor.next();
//...
}

关于java - 什么取代了 MongoDB AggregationOutput 类?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23673372/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com