Spring Data-MongoDb聚合方法的选项 [英] Spring Data-MongoDb Options for aggregation method

查看:109
本文介绍了Spring Data-MongoDb聚合方法的选项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在spring data-mongodb框架的聚合方法中设置" allowDiskUse "选项?

How can i set "allowDiskUse" option in aggregation method in spring data-mongodb framework ?

推荐答案

Spring Data MongoDB中的核心聚合抽象是-顾名思义-Aggregation.它公开了一个流畅的API,可以使用聚合操作来构建管道.

The core aggregation abstraction in Spring Data MongoDB is - as the name suggests - Aggregation. It exposes a fluent API to build up a pipeline using aggregation operations.

从1.6.0.M1版本开始,Aggregation类具有….withOptions(…)

As of version 1.6.0.M1 the Aggregation class has a ….withOptions(…) method to be used like this:

Aggregation aggregation = newAggregation(…) // build up pipeline in here
  .withOptions(newAggregationOptions().allowDiskUse(true).build());

这篇关于Spring Data-MongoDb聚合方法的选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆