- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
使用jongo查询MongoDB时有没有办法添加allowDiscUse: true
?我发现这样的错误 - `排序超出了 104857600 字节的内存限制,但没有选择外部排序。正在中止操作。通过allowDiskUse:true 来选择加入可以通过这样的方式来阻止,您的聚合看起来像
aggregate([{$sort:...},{$$skip:...}...],{allowDiscUse: true})
但据我所知,Jongo 中的Aggregate
类仅将管道应用于自身,然后您可以使用 as
方法执行该管道。
MongoCollection catalogCollection = mongoHolder.getCatalogJongo(param.id, false);
Aggregate aggregation = catalogCollection.aggregate("{$match: #}", query.build());
aggregation.and("{$skip: #}", param.offset);
aggregation.and("{$limit: #}", param.limit);
List<BasicDBObject> result = aggregation.as(BasicDBObject.class);
有什么方法可以将该参数传递给 mongo 而无需从 Jongo 切换到其他东西吗?
最佳答案
您可以使用选项方法:
AggregationOptions options = AggregationOptions.builder().allowDiskUse(true).build());
List<BasicDBObject> result = collection.aggregate("...").options(options).as(BasicDBObject.class);
请参阅 Jongo Aggregate 测试类以查看工作示例 https://github.com/bguerout/jongo/blob/20ed6e79c0801ae1af2dc3d4fee240e201ad93dd/src/test/java/org/jongo/AggregateTest.java#L120
关于java - 使用 Jongo 时允许光盘使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36642619/
我想用 list-style-type: disc; 列出一些程序。 但是列表项没有这个“disc”并且有滚动条,我不知道为什么......看这里(Link)。 它应该只是一个带有光盘图标的列表,每个
使用 cygwin 终端,我的 .bashrc 中有以下内容: export WINHOME="/cygdrive/c/Users/userName" export TUTORING="$WINHOM
我创建了一个别名,以免每次我移动到一个新目录时都写 ls: alias cl='cd_(){ cd "$@" && ls; }; cd_' 假设我有一个名为“下载”的文件夹(我当然碰巧有),所以我只需
我是一名优秀的程序员,十分优秀!