Package com.mongodb.client.model
Class AggregateOutStageOptions
- java.lang.Object
-
- com.mongodb.client.model.AggregateOutStageOptions
-
public class AggregateOutStageOptions extends Object
Options for the $out aggregation stage- Since:
- 3.10
- See Also:
Aggregates.out(String, AggregateOutStageOptions)- MongoDB documentation
- $out
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAggregateOutStageOptions.ModeThe output mode
-
Constructor Summary
Constructors Constructor Description AggregateOutStageOptions()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AggregateOutStageOptionsdatabaseName(String databaseName)Sets the name of the database in which to write the output collection.StringgetDatabaseName()Gets the name of the database in which to write the output collection.AggregateOutStageOptions.ModegetMode()Gets the output mode.BsongetUniqueKey()Gets the document describing the unique keys used for comparing documents in the output collection when the mode is eitherMode#REPLACE_DOCUMENTSorMode#INSERT_DOCUMENTS.AggregateOutStageOptionsmode(AggregateOutStageOptions.Mode mode)Sets the output mode.AggregateOutStageOptionsuniqueKey(Bson uniqueKey)Sets the document describing the unique keys used for comparing documents in the output collection when the mode is eitherMode#REPLACE_DOCUMENTSorMode#INSERT_DOCUMENTS.
-
-
-
Method Detail
-
getMode
public AggregateOutStageOptions.Mode getMode()
Gets the output mode.- Returns:
- the mode, which may not be null
-
mode
public AggregateOutStageOptions mode(AggregateOutStageOptions.Mode mode)
Sets the output mode.- Parameters:
mode- the mode, which may not be null- Returns:
- this
-
getDatabaseName
@Nullable public String getDatabaseName()
Gets the name of the database in which to write the output collection. The default behavior is to write the output collection in the same database as the source collection.- Returns:
- the database name, which may be null
- Since server release
- 4.2
-
databaseName
public AggregateOutStageOptions databaseName(@Nullable String databaseName)
Sets the name of the database in which to write the output collection.- Parameters:
databaseName- the database name, which may be null- Returns:
- this
- Since server release
- 4.2
-
getUniqueKey
@Nullable public Bson getUniqueKey()
Gets the document describing the unique keys used for comparing documents in the output collection when the mode is eitherMode#REPLACE_DOCUMENTSorMode#INSERT_DOCUMENTS. The format is similar to that used to define a unique index on one or more fields, though the order of fields does not matter. The default value is the document key:- For an unsharded output collection, the document key is
{_id: 1}. - For a sharded output collection, the document key is
{_id: 1}plus all the fields of the shard key.
- Returns:
- the unique key, which may be null
- See Also:
AggregateOutStageOptions.Mode.REPLACE_DOCUMENTS,AggregateOutStageOptions.Mode.INSERT_DOCUMENTS,Indexes.ascending(String...)- Since server release
- 4.2
- For an unsharded output collection, the document key is
-
uniqueKey
public AggregateOutStageOptions uniqueKey(@Nullable Bson uniqueKey)
Sets the document describing the unique keys used for comparing documents in the output collection when the mode is eitherMode#REPLACE_DOCUMENTSorMode#INSERT_DOCUMENTS. The format is similar to that used to define a unique index on one or more fields, though the order of fields does not matter. The default value is the document key:- For an unsharded output collection, the document key is
{_id: 1}. - For a sharded output collection, the document key is
{_id: 1}plus all the fields of the shard key.
- Parameters:
uniqueKey- the unique key, which may be null- Returns:
- this
- Since server release
- 4.2
- For an unsharded output collection, the document key is
-
-