Class AggregateOutStageOptions

    • Constructor Detail

      • AggregateOutStageOptions

        public AggregateOutStageOptions​()
    • Method Detail

      • 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 either Mode#REPLACE_DOCUMENTS or Mode#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
      • 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 either Mode#REPLACE_DOCUMENTS or Mode#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