• Type Parameters:
    O - the output type used to lookup the collection name

    public class Out<O>
    extends Stage
    Takes the documents returned by the aggregation pipeline and writes them to a specified collection. The $out operator must be the last stage in the pipeline. The $out operator lets the aggregation framework return result sets of any size.
    • Constructor Detail

      • Out

        protected Out()
    • Method Detail

      • to

        public static <O> Out<O> to​(Class<O> type)
        Creates a $out stage with target type/collection
        Type Parameters:
        O - the output type used to lookup the collection name
        Parameters:
        type - the type to use to determine the target collection
        Returns:
        the new stage
      • to

        public static Out<org.bson.Document> to​(String collection)
        Creates a $out stage with target collection
        Parameters:
        collection - the target collection
        Returns:
        the new stage
      • getCollection

        public String getCollection()
        Returns:
        the collection name
        Developer note.
        This is an internal item. Its function and presence are subject to change without warning. Its use is highly discouraged.
      • getType

        public Class<?> getType()
        Returns:
        the type representing the collection
        Developer note.
        This is an internal item. Its function and presence are subject to change without warning. Its use is highly discouraged.