吗啡可以支持 allowDiskUse 吗?

Could morphia support allowDiskUse?

在我们开发吗啡的过程中,遇到了以下错误:

MongoDB : Sort exceeded memory limit of 104857600 bytes

根据指南:http://www.mkyong.com/mongodb/mongodb-sort-exceeded-memory-limit-of-104857600-bytes/,操作 'allow disk use' 是解决方案。

我的问题:

  1. If morphia supports allowDiskUse operation, if it is possible to show some sample codes?
  2. If morphia not #supports this operation, If it is possible to add 'allowDiskUse' from command line as configurations and all aggregations could use 'allowDiskUse' condition.

谢谢

我也遇到了这个问题。解决方案只是使用您的 AggregatonOptions 启用此功能,如下所示:

AggregationOptions options = AggregationOptions.builder()
            // Possibly more stuff here...
            .allowDiskUse(true) // That's it.
            .build();

然后像这样汇总:

aggregation.aggregate(MyClass.class, options);