1
現在、私はmongoDBをmongoTemplateとして春に使用しています。真の解決策ですが、私がtrueに設定しようとしましたが、何の結果がどのように上記のコードallowDiskUseを設定する方法:spring mongoTemplate
のために設定を教えていないしなさい:public List<BasicDBObject> getMoviesByName() {
Aggregation aggregation = newAggregation(unwind("movies"),
match(where("movies.language").is("english")),
sort(Sort.Direction.DESC, "createDate"),
group(fields().and("_id", "$_id").and("category", "$category")).push("$movies").as("movies"),
project(fields().and("category", "$category").and("movies", "$movies")).andExclude("_id"));
AggregationResults<BasicDBObject> groupResults = mongoTemplate.aggregate(
aggregation, "movieCollection", BasicDBObject.class);
return groupResults.getMappedResults();
}
私はいくつかの記事allowDiskUseを研究している
com.mongodb.CommandFailureException: { "serverUsed" : "XXX.XXX.XX.XX:27017" , "errmsg" : "exception: Sort exceeded memory limit of 104857600 bytes, but did not opt in to external sorting. Aborting operation. Pass allowDiskUse:true to opt in." , "code" : 16819 , "ok" : 0.0}
例外が取得しています
のような集計オプションを設定できますが、BasicDBObjectを 'AggregationResults groupResults = mongoTemplate.aggregate( 集約、 "movieCollection" を試してみました.class).withOptions(newAggregationOptions()。allowDiskUse(true).build()); '? –
chridam
私は上記のコードを試したが結果はなかった –