Interface MongoDatabase


  • @ThreadSafe
    @Deprecated
    public interface MongoDatabase
    Deprecated.
    Prefer the Reactive Streams-based asynchronous driver (mongodb-driver-reactivestreams artifactId)
    The MongoDatabase interface.

    Note: Additions to this interface will not be considered to break binary compatibility.

    Since:
    3.0
    • Method Summary

      All Methods Instance Methods Abstract Methods Deprecated Methods 
      Modifier and Type Method Description
      AggregateIterable<org.bson.Document> aggregate​(ClientSession clientSession, List<? extends org.bson.conversions.Bson> pipeline)
      Deprecated.
      Runs an aggregation framework pipeline on the database for pipeline stages that do not require an underlying collection, such as $currentOp and $listLocalSessions.
      <TResult> AggregateIterable<TResult> aggregate​(ClientSession clientSession, List<? extends org.bson.conversions.Bson> pipeline, Class<TResult> resultClass)
      Deprecated.
      Runs an aggregation framework pipeline on the database for pipeline stages that do not require an underlying collection, such as $currentOp and $listLocalSessions.
      AggregateIterable<org.bson.Document> aggregate​(List<? extends org.bson.conversions.Bson> pipeline)
      Deprecated.
      Runs an aggregation framework pipeline on the database for pipeline stages that do not require an underlying collection, such as $currentOp and $listLocalSessions.
      <TResult> AggregateIterable<TResult> aggregate​(List<? extends org.bson.conversions.Bson> pipeline, Class<TResult> resultClass)
      Deprecated.
      Runs an aggregation framework pipeline on the database for pipeline stages that do not require an underlying collection, such as $currentOp and $listLocalSessions.
      void createCollection​(ClientSession clientSession, String collectionName, com.mongodb.async.SingleResultCallback<Void> callback)
      Deprecated.
      Create a new collection with the given name.
      void createCollection​(ClientSession clientSession, String collectionName, com.mongodb.client.model.CreateCollectionOptions options, com.mongodb.async.SingleResultCallback<Void> callback)
      Deprecated.
      Create a new collection with the selected options
      void createCollection​(String collectionName, com.mongodb.async.SingleResultCallback<Void> callback)
      Deprecated.
      Create a new collection with the given name.
      void createCollection​(String collectionName, com.mongodb.client.model.CreateCollectionOptions options, com.mongodb.async.SingleResultCallback<Void> callback)
      Deprecated.
      Create a new collection with the selected options
      void createView​(ClientSession clientSession, String viewName, String viewOn, List<? extends org.bson.conversions.Bson> pipeline, com.mongodb.async.SingleResultCallback<Void> callback)
      Deprecated.
      Creates a view with the given name, backing collection/view name, and aggregation pipeline that defines the view.
      void createView​(ClientSession clientSession, String viewName, String viewOn, List<? extends org.bson.conversions.Bson> pipeline, com.mongodb.client.model.CreateViewOptions createViewOptions, com.mongodb.async.SingleResultCallback<Void> callback)
      Deprecated.
      Creates a view with the given name, backing collection/view name, aggregation pipeline, and options that defines the view.
      void createView​(String viewName, String viewOn, List<? extends org.bson.conversions.Bson> pipeline, com.mongodb.async.SingleResultCallback<Void> callback)
      Deprecated.
      Creates a view with the given name, backing collection/view name, and aggregation pipeline that defines the view.
      void createView​(String viewName, String viewOn, List<? extends org.bson.conversions.Bson> pipeline, com.mongodb.client.model.CreateViewOptions createViewOptions, com.mongodb.async.SingleResultCallback<Void> callback)
      Deprecated.
      Creates a view with the given name, backing collection/view name, aggregation pipeline, and options that defines the view.
      void drop​(ClientSession clientSession, com.mongodb.async.SingleResultCallback<Void> callback)
      Deprecated.
      Drops this database.
      void drop​(com.mongodb.async.SingleResultCallback<Void> callback)
      Deprecated.
      Drops this database.
      org.bson.codecs.configuration.CodecRegistry getCodecRegistry()
      Deprecated.
      Get the codec registry for the MongoDatabase.
      MongoCollection<org.bson.Document> getCollection​(String collectionName)
      Deprecated.
      Gets a collection.
      <TDocument>
      MongoCollection<TDocument>
      getCollection​(String collectionName, Class<TDocument> documentClass)
      Deprecated.
      Gets a collection, with a specific default document class.
      String getName()
      Deprecated.
      Gets the name of the database.
      com.mongodb.ReadConcern getReadConcern()
      Deprecated.
      Get the read concern for the MongoDatabase.
      com.mongodb.ReadPreference getReadPreference()
      Deprecated.
      Get the read preference for the MongoDatabase.
      com.mongodb.WriteConcern getWriteConcern()
      Deprecated.
      Get the write concern for the MongoDatabase.
      MongoIterable<String> listCollectionNames()
      Deprecated.
      Gets the names of all the collections in this database.
      MongoIterable<String> listCollectionNames​(ClientSession clientSession)
      Deprecated.
      Gets the names of all the collections in this database.
      ListCollectionsIterable<org.bson.Document> listCollections()
      Deprecated.
      Finds all the collections in this database.
      ListCollectionsIterable<org.bson.Document> listCollections​(ClientSession clientSession)
      Deprecated.
      Finds all the collections in this database.
      <TResult> ListCollectionsIterable<TResult> listCollections​(ClientSession clientSession, Class<TResult> resultClass)
      Deprecated.
      Finds all the collections in this database.
      <TResult> ListCollectionsIterable<TResult> listCollections​(Class<TResult> resultClass)
      Deprecated.
      Finds all the collections in this database.
      void runCommand​(ClientSession clientSession, org.bson.conversions.Bson command, com.mongodb.async.SingleResultCallback<org.bson.Document> callback)
      Deprecated.
      Executes the given command in the context of the current database with a read preference of ReadPreference.primary().
      void runCommand​(ClientSession clientSession, org.bson.conversions.Bson command, com.mongodb.ReadPreference readPreference, com.mongodb.async.SingleResultCallback<org.bson.Document> callback)
      Deprecated.
      Executes the given command in the context of the current database with the given read preference.
      <TResult> void runCommand​(ClientSession clientSession, org.bson.conversions.Bson command, com.mongodb.ReadPreference readPreference, Class<TResult> resultClass, com.mongodb.async.SingleResultCallback<TResult> callback)
      Deprecated.
      Executes the given command in the context of the current database with the given read preference.
      <TResult> void runCommand​(ClientSession clientSession, org.bson.conversions.Bson command, Class<TResult> resultClass, com.mongodb.async.SingleResultCallback<TResult> callback)
      Deprecated.
      Executes the given command in the context of the current database with a read preference of ReadPreference.primary().
      void runCommand​(org.bson.conversions.Bson command, com.mongodb.async.SingleResultCallback<org.bson.Document> callback)
      Deprecated.
      Executes the given command in the context of the current database with a read preference of ReadPreference.primary().
      void runCommand​(org.bson.conversions.Bson command, com.mongodb.ReadPreference readPreference, com.mongodb.async.SingleResultCallback<org.bson.Document> callback)
      Deprecated.
      Executes the given command in the context of the current database with the given read preference.
      <TResult> void runCommand​(org.bson.conversions.Bson command, com.mongodb.ReadPreference readPreference, Class<TResult> resultClass, com.mongodb.async.SingleResultCallback<TResult> callback)
      Deprecated.
      Executes the given command in the context of the current database with the given read preference.
      <TResult> void runCommand​(org.bson.conversions.Bson command, Class<TResult> resultClass, com.mongodb.async.SingleResultCallback<TResult> callback)
      Deprecated.
      Executes the given command in the context of the current database with a read preference of ReadPreference.primary().
      ChangeStreamIterable<org.bson.Document> watch()
      Deprecated.
      Creates a change stream for this database.
      ChangeStreamIterable<org.bson.Document> watch​(ClientSession clientSession)
      Deprecated.
      Creates a change stream for this database.
      <TResult> ChangeStreamIterable<TResult> watch​(ClientSession clientSession, Class<TResult> resultClass)
      Deprecated.
      Creates a change stream for this database.
      ChangeStreamIterable<org.bson.Document> watch​(ClientSession clientSession, List<? extends org.bson.conversions.Bson> pipeline)
      Deprecated.
      Creates a change stream for this database.
      <TResult> ChangeStreamIterable<TResult> watch​(ClientSession clientSession, List<? extends org.bson.conversions.Bson> pipeline, Class<TResult> resultClass)
      Deprecated.
      Creates a change stream for this database.
      <TResult> ChangeStreamIterable<TResult> watch​(Class<TResult> resultClass)
      Deprecated.
      Creates a change stream for this database.
      ChangeStreamIterable<org.bson.Document> watch​(List<? extends org.bson.conversions.Bson> pipeline)
      Deprecated.
      Creates a change stream for this database.
      <TResult> ChangeStreamIterable<TResult> watch​(List<? extends org.bson.conversions.Bson> pipeline, Class<TResult> resultClass)
      Deprecated.
      Creates a change stream for this database.
      MongoDatabase withCodecRegistry​(org.bson.codecs.configuration.CodecRegistry codecRegistry)
      Deprecated.
      Create a new MongoDatabase instance with a different codec registry.
      MongoDatabase withReadConcern​(com.mongodb.ReadConcern readConcern)
      Deprecated.
      Create a new MongoDatabase instance with a different read concern.
      MongoDatabase withReadPreference​(com.mongodb.ReadPreference readPreference)
      Deprecated.
      Create a new MongoDatabase instance with a different read preference.
      MongoDatabase withWriteConcern​(com.mongodb.WriteConcern writeConcern)
      Deprecated.
      Create a new MongoDatabase instance with a different write concern.
    • Method Detail

      • getName

        String getName()
        Deprecated.
        Gets the name of the database.
        Returns:
        the database name
      • getCodecRegistry

        org.bson.codecs.configuration.CodecRegistry getCodecRegistry()
        Deprecated.
        Get the codec registry for the MongoDatabase.
        Returns:
        the CodecRegistry
      • getReadPreference

        com.mongodb.ReadPreference getReadPreference()
        Deprecated.
        Get the read preference for the MongoDatabase.
        Returns:
        the ReadPreference
      • getWriteConcern

        com.mongodb.WriteConcern getWriteConcern()
        Deprecated.
        Get the write concern for the MongoDatabase.
        Returns:
        the WriteConcern
      • getReadConcern

        com.mongodb.ReadConcern getReadConcern()
        Deprecated.
        Get the read concern for the MongoDatabase.
        Returns:
        the ReadConcern
        Since:
        3.2
        MongoDB documentation
        Read Concern
        Since server release
        3.2
      • withCodecRegistry

        MongoDatabase withCodecRegistry​(org.bson.codecs.configuration.CodecRegistry codecRegistry)
        Deprecated.
        Create a new MongoDatabase instance with a different codec registry.
        Parameters:
        codecRegistry - the new CodecRegistry for the database
        Returns:
        a new MongoDatabase instance with the different codec registry
      • withReadPreference

        MongoDatabase withReadPreference​(com.mongodb.ReadPreference readPreference)
        Deprecated.
        Create a new MongoDatabase instance with a different read preference.
        Parameters:
        readPreference - the new ReadPreference for the database
        Returns:
        a new MongoDatabase instance with the different readPreference
      • withWriteConcern

        MongoDatabase withWriteConcern​(com.mongodb.WriteConcern writeConcern)
        Deprecated.
        Create a new MongoDatabase instance with a different write concern.
        Parameters:
        writeConcern - the new WriteConcern for the database
        Returns:
        a new MongoDatabase instance with the different writeConcern
      • withReadConcern

        MongoDatabase withReadConcern​(com.mongodb.ReadConcern readConcern)
        Deprecated.
        Create a new MongoDatabase instance with a different read concern.
        Parameters:
        readConcern - the new ReadConcern for the database
        Returns:
        a new MongoDatabase instance with the different ReadConcern
        Since:
        3.2
        MongoDB documentation
        Read Concern
        Since server release
        3.2
      • getCollection

        MongoCollection<org.bson.Document> getCollection​(String collectionName)
        Deprecated.
        Gets a collection.
        Parameters:
        collectionName - the name of the collection to return
        Returns:
        the collection
        Throws:
        IllegalArgumentException - if collectionName is invalid
        See Also:
        MongoNamespace.checkCollectionNameValidity(String)
      • getCollection

        <TDocument> MongoCollection<TDocument> getCollection​(String collectionName,
                                                             Class<TDocument> documentClass)
        Deprecated.
        Gets a collection, with a specific default document class.
        Type Parameters:
        TDocument - the type of the class to use instead of Document.
        Parameters:
        collectionName - the name of the collection to return
        documentClass - the default class to cast any documents returned from the database into.
        Returns:
        the collection
      • runCommand

        void runCommand​(org.bson.conversions.Bson command,
                        com.mongodb.async.SingleResultCallback<org.bson.Document> callback)
        Deprecated.
        Executes the given command in the context of the current database with a read preference of ReadPreference.primary().
        Parameters:
        command - the command to be run
        callback - the callback that is passed the command result
      • runCommand

        void runCommand​(org.bson.conversions.Bson command,
                        com.mongodb.ReadPreference readPreference,
                        com.mongodb.async.SingleResultCallback<org.bson.Document> callback)
        Deprecated.
        Executes the given command in the context of the current database with the given read preference.
        Parameters:
        command - the command to be run
        readPreference - the ReadPreference to be used when executing the command
        callback - the callback that is passed the command result
      • runCommand

        <TResult> void runCommand​(org.bson.conversions.Bson command,
                                  Class<TResult> resultClass,
                                  com.mongodb.async.SingleResultCallback<TResult> callback)
        Deprecated.
        Executes the given command in the context of the current database with a read preference of ReadPreference.primary().
        Type Parameters:
        TResult - the type of the class to use instead of Document.
        Parameters:
        command - the command to be run
        resultClass - the default class to cast any documents returned from the database into.
        callback - the callback that is passed the command result
      • runCommand

        <TResult> void runCommand​(org.bson.conversions.Bson command,
                                  com.mongodb.ReadPreference readPreference,
                                  Class<TResult> resultClass,
                                  com.mongodb.async.SingleResultCallback<TResult> callback)
        Deprecated.
        Executes the given command in the context of the current database with the given read preference.
        Type Parameters:
        TResult - the type of the class to use instead of Document.
        Parameters:
        command - the command to be run
        readPreference - the ReadPreference to be used when executing the command
        resultClass - the default class to cast any documents returned from the database into.
        callback - the callback that is passed the command result
      • runCommand

        void runCommand​(ClientSession clientSession,
                        org.bson.conversions.Bson command,
                        com.mongodb.async.SingleResultCallback<org.bson.Document> callback)
        Deprecated.
        Executes the given command in the context of the current database with a read preference of ReadPreference.primary().
        Parameters:
        clientSession - the client session with which to associate this operation
        command - the command to be run
        callback - the callback that is passed the command result
        Since:
        3.6
        Since server release
        3.6
      • runCommand

        void runCommand​(ClientSession clientSession,
                        org.bson.conversions.Bson command,
                        com.mongodb.ReadPreference readPreference,
                        com.mongodb.async.SingleResultCallback<org.bson.Document> callback)
        Deprecated.
        Executes the given command in the context of the current database with the given read preference.
        Parameters:
        clientSession - the client session with which to associate this operation
        command - the command to be run
        readPreference - the ReadPreference to be used when executing the command
        callback - the callback that is passed the command result
        Since:
        3.6
        Since server release
        3.6
      • runCommand

        <TResult> void runCommand​(ClientSession clientSession,
                                  org.bson.conversions.Bson command,
                                  Class<TResult> resultClass,
                                  com.mongodb.async.SingleResultCallback<TResult> callback)
        Deprecated.
        Executes the given command in the context of the current database with a read preference of ReadPreference.primary().
        Type Parameters:
        TResult - the type of the class to use instead of Document.
        Parameters:
        clientSession - the client session with which to associate this operation
        command - the command to be run
        resultClass - the default class to cast any documents returned from the database into.
        callback - the callback that is passed the command result
        Since:
        3.6
        Since server release
        3.6
      • runCommand

        <TResult> void runCommand​(ClientSession clientSession,
                                  org.bson.conversions.Bson command,
                                  com.mongodb.ReadPreference readPreference,
                                  Class<TResult> resultClass,
                                  com.mongodb.async.SingleResultCallback<TResult> callback)
        Deprecated.
        Executes the given command in the context of the current database with the given read preference.
        Type Parameters:
        TResult - the type of the class to use instead of Document.
        Parameters:
        clientSession - the client session with which to associate this operation
        command - the command to be run
        readPreference - the ReadPreference to be used when executing the command
        resultClass - the default class to cast any documents returned from the database into.
        callback - the callback that is passed the command result
        Since:
        3.6
        Since server release
        3.6
      • drop

        void drop​(com.mongodb.async.SingleResultCallback<Void> callback)
        Deprecated.
        Drops this database.
        Parameters:
        callback - the callback that is completed once the database has been dropped
        MongoDB documentation
        Drop database
      • drop

        void drop​(ClientSession clientSession,
                  com.mongodb.async.SingleResultCallback<Void> callback)
        Deprecated.
        Drops this database.
        Parameters:
        callback - the callback that is completed once the database has been dropped
        clientSession - the client session with which to associate this operation
        Since:
        3.6
        MongoDB documentation
        Drop database
        Since server release
        3.6
      • listCollectionNames

        MongoIterable<String> listCollectionNames()
        Deprecated.
        Gets the names of all the collections in this database.
        Returns:
        an iterable containing all the names of all the collections in this database
      • listCollectionNames

        MongoIterable<String> listCollectionNames​(ClientSession clientSession)
        Deprecated.
        Gets the names of all the collections in this database.
        Parameters:
        clientSession - the client session with which to associate this operation
        Returns:
        an iterable containing all the names of all the collections in this database
        Since:
        3.6
        Since server release
        3.6
      • listCollections

        ListCollectionsIterable<org.bson.Document> listCollections()
        Deprecated.
        Finds all the collections in this database.
        Returns:
        the list collections iterable interface
        MongoDB documentation
        listCollections
      • listCollections

        <TResult> ListCollectionsIterable<TResult> listCollections​(Class<TResult> resultClass)
        Deprecated.
        Finds all the collections in this database.
        Type Parameters:
        TResult - the target document type of the iterable.
        Parameters:
        resultClass - the class to decode each document into
        Returns:
        the list collections iterable interface
        MongoDB documentation
        listCollections
      • listCollections

        ListCollectionsIterable<org.bson.Document> listCollections​(ClientSession clientSession)
        Deprecated.
        Finds all the collections in this database.
        Parameters:
        clientSession - the client session with which to associate this operation
        Returns:
        the list collections iterable interface
        Since:
        3.6
        MongoDB documentation
        listCollections
        Since server release
        3.6
      • listCollections

        <TResult> ListCollectionsIterable<TResult> listCollections​(ClientSession clientSession,
                                                                   Class<TResult> resultClass)
        Deprecated.
        Finds all the collections in this database.
        Type Parameters:
        TResult - the target document type of the iterable.
        Parameters:
        clientSession - the client session with which to associate this operation
        resultClass - the class to decode each document into
        Returns:
        the list collections iterable interface
        Since:
        3.6
        MongoDB documentation
        listCollections
        Since server release
        3.6
      • createCollection

        void createCollection​(String collectionName,
                              com.mongodb.async.SingleResultCallback<Void> callback)
        Deprecated.
        Create a new collection with the given name.
        Parameters:
        collectionName - the name for the new collection to create
        callback - the callback that is completed once the collection has been created
        MongoDB documentation
        Create Command
      • createCollection

        void createCollection​(String collectionName,
                              com.mongodb.client.model.CreateCollectionOptions options,
                              com.mongodb.async.SingleResultCallback<Void> callback)
        Deprecated.
        Create a new collection with the selected options
        Parameters:
        collectionName - the name for the new collection to create
        options - various options for creating the collection
        callback - the callback that is completed once the collection has been created
        MongoDB documentation
        Create Command
      • createCollection

        void createCollection​(ClientSession clientSession,
                              String collectionName,
                              com.mongodb.async.SingleResultCallback<Void> callback)
        Deprecated.
        Create a new collection with the given name.
        Parameters:
        clientSession - the client session with which to associate this operation
        collectionName - the name for the new collection to create
        callback - the callback that is completed once the collection has been created
        Since:
        3.6
        MongoDB documentation
        Create Command
        Since server release
        3.6
      • createCollection

        void createCollection​(ClientSession clientSession,
                              String collectionName,
                              com.mongodb.client.model.CreateCollectionOptions options,
                              com.mongodb.async.SingleResultCallback<Void> callback)
        Deprecated.
        Create a new collection with the selected options
        Parameters:
        clientSession - the client session with which to associate this operation
        collectionName - the name for the new collection to create
        options - various options for creating the collection
        callback - the callback that is completed once the collection has been created
        Since:
        3.6
        MongoDB documentation
        Create Command
        Since server release
        3.6
      • createView

        void createView​(String viewName,
                        String viewOn,
                        List<? extends org.bson.conversions.Bson> pipeline,
                        com.mongodb.async.SingleResultCallback<Void> callback)
        Deprecated.
        Creates a view with the given name, backing collection/view name, and aggregation pipeline that defines the view.
        Parameters:
        viewName - the name of the view to create
        viewOn - the backing collection/view for the view
        pipeline - the pipeline that defines the view
        callback - the callback that is completed once the collection has been created
        Since:
        3.4
        MongoDB documentation
        Create Command
        Since server release
        3.4
      • createView

        void createView​(String viewName,
                        String viewOn,
                        List<? extends org.bson.conversions.Bson> pipeline,
                        com.mongodb.client.model.CreateViewOptions createViewOptions,
                        com.mongodb.async.SingleResultCallback<Void> callback)
        Deprecated.
        Creates a view with the given name, backing collection/view name, aggregation pipeline, and options that defines the view.
        Parameters:
        viewName - the name of the view to create
        viewOn - the backing collection/view for the view
        pipeline - the pipeline that defines the view
        createViewOptions - various options for creating the view
        callback - the callback that is completed once the collection has been created
        Since:
        3.4
        MongoDB documentation
        Create Command
        Since server release
        3.4
      • createView

        void createView​(ClientSession clientSession,
                        String viewName,
                        String viewOn,
                        List<? extends org.bson.conversions.Bson> pipeline,
                        com.mongodb.async.SingleResultCallback<Void> callback)
        Deprecated.
        Creates a view with the given name, backing collection/view name, and aggregation pipeline that defines the view.
        Parameters:
        clientSession - the client session with which to associate this operation
        viewName - the name of the view to create
        viewOn - the backing collection/view for the view
        pipeline - the pipeline that defines the view
        callback - the callback that is completed once the collection has been created
        Since:
        3.6
        MongoDB documentation
        Create Command
        Since server release
        3.6
      • createView

        void createView​(ClientSession clientSession,
                        String viewName,
                        String viewOn,
                        List<? extends org.bson.conversions.Bson> pipeline,
                        com.mongodb.client.model.CreateViewOptions createViewOptions,
                        com.mongodb.async.SingleResultCallback<Void> callback)
        Deprecated.
        Creates a view with the given name, backing collection/view name, aggregation pipeline, and options that defines the view.
        Parameters:
        clientSession - the client session with which to associate this operation
        viewName - the name of the view to create
        viewOn - the backing collection/view for the view
        pipeline - the pipeline that defines the view
        createViewOptions - various options for creating the view
        callback - the callback that is completed once the collection has been created
        Since:
        3.6
        MongoDB documentation
        Create Command
        Since server release
        3.6
      • watch

        ChangeStreamIterable<org.bson.Document> watch()
        Deprecated.
        Creates a change stream for this database.
        Returns:
        the change stream iterable
        Since:
        3.8
        MongoDB documentation
        Change Streams
        Since server release
        4.0
      • watch

        <TResult> ChangeStreamIterable<TResult> watch​(Class<TResult> resultClass)
        Deprecated.
        Creates a change stream for this database.
        Type Parameters:
        TResult - the target document type of the iterable.
        Parameters:
        resultClass - the class to decode each document into
        Returns:
        the change stream iterable
        Since:
        3.8
        MongoDB documentation
        Change Streams
        Since server release
        4.0
      • watch

        ChangeStreamIterable<org.bson.Document> watch​(List<? extends org.bson.conversions.Bson> pipeline)
        Deprecated.
        Creates a change stream for this database.
        Parameters:
        pipeline - the aggregation pipeline to apply to the change stream.
        Returns:
        the change stream iterable
        Since:
        3.8
        MongoDB documentation
        Change Streams
        Since server release
        4.0
      • watch

        <TResult> ChangeStreamIterable<TResult> watch​(List<? extends org.bson.conversions.Bson> pipeline,
                                                      Class<TResult> resultClass)
        Deprecated.
        Creates a change stream for this database.
        Type Parameters:
        TResult - the target document type of the iterable.
        Parameters:
        pipeline - the aggregation pipeline to apply to the change stream
        resultClass - the class to decode each document into
        Returns:
        the change stream iterable
        Since:
        3.8
        MongoDB documentation
        Change Streams
        Since server release
        4.0
      • watch

        ChangeStreamIterable<org.bson.Document> watch​(ClientSession clientSession)
        Deprecated.
        Creates a change stream for this database.
        Parameters:
        clientSession - the client session with which to associate this operation
        Returns:
        the change stream iterable
        Since:
        3.8
        MongoDB documentation
        Change Streams
        Since server release
        4.0
      • watch

        <TResult> ChangeStreamIterable<TResult> watch​(ClientSession clientSession,
                                                      Class<TResult> resultClass)
        Deprecated.
        Creates a change stream for this database.
        Type Parameters:
        TResult - the target document type of the iterable.
        Parameters:
        clientSession - the client session with which to associate this operation
        resultClass - the class to decode each document into
        Returns:
        the change stream iterable
        Since:
        3.8
        MongoDB documentation
        Change Streams
        Since server release
        4.0
      • watch

        ChangeStreamIterable<org.bson.Document> watch​(ClientSession clientSession,
                                                      List<? extends org.bson.conversions.Bson> pipeline)
        Deprecated.
        Creates a change stream for this database.
        Parameters:
        clientSession - the client session with which to associate this operation
        pipeline - the aggregation pipeline to apply to the change stream.
        Returns:
        the change stream iterable
        Since:
        3.8
        MongoDB documentation
        Change Streams
        Since server release
        4.0
      • watch

        <TResult> ChangeStreamIterable<TResult> watch​(ClientSession clientSession,
                                                      List<? extends org.bson.conversions.Bson> pipeline,
                                                      Class<TResult> resultClass)
        Deprecated.
        Creates a change stream for this database.
        Type Parameters:
        TResult - the target document type of the iterable.
        Parameters:
        clientSession - the client session with which to associate this operation
        pipeline - the aggregation pipeline to apply to the change stream
        resultClass - the class to decode each document into
        Returns:
        the change stream iterable
        Since:
        3.8
        MongoDB documentation
        Change Streams
        Since server release
        4.0
      • aggregate

        AggregateIterable<org.bson.Document> aggregate​(List<? extends org.bson.conversions.Bson> pipeline)
        Deprecated.
        Runs an aggregation framework pipeline on the database for pipeline stages that do not require an underlying collection, such as $currentOp and $listLocalSessions.
        Parameters:
        pipeline - the aggregation pipeline
        Returns:
        an iterable containing the result of the aggregation operation
        Since:
        3.10
        MongoDB documentation
        Aggregate Command
        Since server release
        3.6
      • aggregate

        <TResult> AggregateIterable<TResult> aggregate​(List<? extends org.bson.conversions.Bson> pipeline,
                                                       Class<TResult> resultClass)
        Deprecated.
        Runs an aggregation framework pipeline on the database for pipeline stages that do not require an underlying collection, such as $currentOp and $listLocalSessions.
        Type Parameters:
        TResult - the target document type of the iterable.
        Parameters:
        pipeline - the aggregation pipeline
        resultClass - the class to decode each document into
        Returns:
        an iterable containing the result of the aggregation operation
        Since:
        3.10
        MongoDB documentation
        Aggregate Command
        Since server release
        3.6
      • aggregate

        AggregateIterable<org.bson.Document> aggregate​(ClientSession clientSession,
                                                       List<? extends org.bson.conversions.Bson> pipeline)
        Deprecated.
        Runs an aggregation framework pipeline on the database for pipeline stages that do not require an underlying collection, such as $currentOp and $listLocalSessions.
        Parameters:
        clientSession - the client session with which to associate this operation
        pipeline - the aggregation pipeline
        Returns:
        an iterable containing the result of the aggregation operation
        Since:
        3.10
        MongoDB documentation
        Aggregate Command
        Since server release
        3.6
      • aggregate

        <TResult> AggregateIterable<TResult> aggregate​(ClientSession clientSession,
                                                       List<? extends org.bson.conversions.Bson> pipeline,
                                                       Class<TResult> resultClass)
        Deprecated.
        Runs an aggregation framework pipeline on the database for pipeline stages that do not require an underlying collection, such as $currentOp and $listLocalSessions.
        Type Parameters:
        TResult - the target document type of the iterable.
        Parameters:
        clientSession - the client session with which to associate this operation
        pipeline - the aggregation pipeline
        resultClass - the class to decode each document into
        Returns:
        an iterable containing the result of the aggregation operation
        Since:
        3.10
        MongoDB documentation
        Aggregate Command
        Since server release
        3.6