Service

trait Service
class Object
trait Matchable
class Any

Value members

Abstract methods

Aggregates documents according to the specified aggregation pipeline.

Aggregates documents according to the specified aggregation pipeline.

Value parameters:
pipeline

the aggregate pipeline

Returns:

a Observable containing the result of the aggregation operation Aggregation

Note:

Requires MongoDB 3.6 or greater

def aggregate(clientSession: ClientSession, pipeline: Seq[Aggregation]): AggregateQuery[Document]

Aggregates documents according to the specified aggregation pipeline.

Aggregates documents according to the specified aggregation pipeline.

Value parameters:
clientSession

the client session with which to associate this operation

pipeline

the aggregate pipeline

Returns:

a Observable containing the result of the aggregation operation Aggregation

Note:

Requires MongoDB 3.6 or greater

def codecRegistry: CodecRegistry

Get the codec registry for the MongoDatabase.

Get the codec registry for the MongoDatabase.

Returns:

the { @link org.bson.codecs.configuration.CodecRegistry}

def createCollection(collectionName: String): Task[Unit]

Create a new collection with the given name.

Create a new collection with the given name.

Create Command

Value parameters:
collectionName

the name for the new collection to create

Returns:

a Observable identifying when the collection has been created

def createCollection(collectionName: String, options: CreateCollectionOptions): Task[Unit]

Create a new collection with the selected options

Create a new collection with the selected options

Create Command

Value parameters:
collectionName

the name for the new collection to create

options

various options for creating the collection

Returns:

a Observable identifying when the collection has been created

def createCollection(clientSession: ClientSession, collectionName: String): Task[Unit]

Create a new collection with the given name.

Create a new collection with the given name.

Create Command

Value parameters:
clientSession

the client session with which to associate this operation

collectionName

the name for the new collection to create

Returns:

a Observable identifying when the collection has been created

Note:

Requires MongoDB 3.6 or greater

def createCollection(clientSession: ClientSession, collectionName: String, options: CreateCollectionOptions): Task[Unit]

Create a new collection with the selected options

Create a new collection with the selected options

Create Command

Value 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

Returns:

a Observable identifying when the collection has been created

Note:

Requires MongoDB 3.6 or greater

def createView(viewName: String, viewOn: String, pipeline: Seq[Aggregation]): Task[Unit]

Creates a view with the given name, backing collection/view name, and aggregation pipeline that defines the view.

Creates a view with the given name, backing collection/view name, and aggregation pipeline that defines the view.

Create Command

Value parameters:
pipeline

the pipeline that defines the view

viewName

the name of the view to create

viewOn

the backing collection/view for the view

Note:

Requires MongoDB 3.4 or greater

def createView(viewName: String, viewOn: String, pipeline: Seq[Aggregation], createViewOptions: CreateViewOptions): Task[Unit]

Creates a view with the given name, backing collection/view name, aggregation pipeline, and options that defines the view.

Creates a view with the given name, backing collection/view name, aggregation pipeline, and options that defines the view.

Create Command

Value parameters:
createViewOptions

various options for creating the view

pipeline

the pipeline that defines the view

viewName

the name of the view to create

viewOn

the backing collection/view for the view

Note:

Requires MongoDB 3.4 or greater

def createView(clientSession: ClientSession, viewName: String, viewOn: String, pipeline: Seq[Aggregation]): Task[Unit]

Creates a view with the given name, backing collection/view name, and aggregation pipeline that defines the view.

Creates a view with the given name, backing collection/view name, and aggregation pipeline that defines the view.

Create Command

Value parameters:
clientSession

the client session with which to associate this operation

pipeline

the pipeline that defines the view

viewName

the name of the view to create

viewOn

the backing collection/view for the view

Note:

Requires MongoDB 3.6 or greater

def createView(clientSession: ClientSession, viewName: String, viewOn: String, pipeline: Seq[Aggregation], createViewOptions: CreateViewOptions): Task[Unit]

Creates a view with the given name, backing collection/view name, aggregation pipeline, and options that defines the view.

Creates a view with the given name, backing collection/view name, aggregation pipeline, and options that defines the view.

Create Command

Value parameters:
clientSession

the client session with which to associate this operation

createViewOptions

various options for creating the view

pipeline

the pipeline that defines the view

viewName

the name of the view to create

viewOn

the backing collection/view for the view

Note:

Requires MongoDB 3.6 or greater

def drop(): Task[Unit]

Drops this database.

Drops this database.

Drop database

Returns:

a Observable identifying when the database has been dropped

def drop(clientSession: ClientSession): Task[Unit]

Drops this database.

Drops this database.

Drop database

Value parameters:
clientSession

the client session with which to associate this operation

Returns:

a Observable identifying when the database has been dropped

Note:

Requires MongoDB 3.6 or greater

def getCollection[A : ClassTag](collectionName: String)(implicit evidence$1: ClassTag[A], codec: Codec[A]): Service[A]

Gets a collection, with a specific default document class.

Gets a collection, with a specific default document class.

Type parameters:
TResult

the type of the class to use instead of Document.

Value parameters:
collectionName

the name of the collection to return

Returns:

the collection

def listCollectionNames(): ZStream[Any, Throwable, String]

Gets the names of all the collections in this database.

Gets the names of all the collections in this database.

Returns:

a Observable with all the names of all the collections in this database

def listCollectionNames(clientSession: ClientSession): ZStream[Any, Throwable, String]

Gets the names of all the collections in this database.

Gets the names of all the collections in this database.

Value parameters:
clientSession

the client session with which to associate this operation

Returns:

a Observable with all the names of all the collections in this database

Note:

Requires MongoDB 3.6 or greater

Finds all the collections in this database.

Finds all the collections in this database.

listCollections

Returns:

the fluent list collections interface

Finds all the collections in this database.

Finds all the collections in this database.

listCollections

Value parameters:
clientSession

the client session with which to associate this operation

Returns:

the fluent list collections interface

Note:

Requires MongoDB 3.6 or greater

def name: String

Gets the name of the database.

Gets the name of the database.

Returns:

the database name

Get the read concern for the MongoDatabase.

Get the read concern for the MongoDatabase.

Returns:

the ReadConcern

Get the read preference for the MongoDatabase.

Get the read preference for the MongoDatabase.

Returns:

the { @link com.mongodb.ReadPreference}

def runCommand(command: Bson): Task[Option[Document]]

Executes command in the context of the current database using the primary server.

Executes command in the context of the current database using the primary server.

Value parameters:
command

the command to be run

Returns:

a Observable containing the command result

def runCommand(command: Bson, readPreference: ReadPreference): Task[Option[Document]]

Executes command in the context of the current database.

Executes command in the context of the current database.

Value parameters:
command

the command to be run

readPreference

the ReadPreference to be used when executing the command

Returns:

a Observable containing the command result

def runCommand(clientSession: ClientSession, command: Bson): Task[Option[Document]]

Executes command in the context of the current database using the primary server.

Executes command in the context of the current database using the primary server.

Value parameters:
clientSession

the client session with which to associate this operation

command

the command to be run

Returns:

a Observable containing the command result

Note:

Requires MongoDB 3.6 or greater

def runCommand(clientSession: ClientSession, command: Bson, readPreference: ReadPreference): Task[Option[Document]]

Executes command in the context of the current database.

Executes command in the context of the current database.

Type parameters:
TResult

the type of the class to use instead of Document.

Value parameters:
command

the command to be run

readPreference

the ReadPreference to be used when executing the command

Returns:

a Observable containing the command result

Note:

Requires MongoDB 3.6 or greater

def startSession(): ZManaged[Any, Throwable, ClientSession]

Creates a client session.

Creates a client session.

'''Note:''' A ClientSession instance can not be used concurrently in multiple asynchronous operations.

Note:

Requires MongoDB 3.6 or greater

def startSession(options: ClientSessionOptions): ZManaged[Any, Throwable, ClientSession]

Creates a client session.

Creates a client session.

'''Note:''' A ClientSession instance can not be used concurrently in multiple asynchronous operations.

Value parameters:
options

the options for the client session

Note:

Requires MongoDB 3.6 or greater

Creates a change stream for this collection.

Creates a change stream for this collection.

Returns:

the change stream observable

Note:

Requires MongoDB 4.0 or greater

Creates a change stream for this collection.

Creates a change stream for this collection.

Value parameters:
pipeline

the aggregation pipeline to apply to the change stream

Returns:

the change stream observable

Note:

Requires MongoDB 4.0 or greater

Creates a change stream for this collection.

Creates a change stream for this collection.

Value parameters:
clientSession

the client session with which to associate this operation

Returns:

the change stream observable

Note:

Requires MongoDB 4.0 or greater

def watch(clientSession: ClientSession, pipeline: Seq[Aggregation]): ChangeStreamQuery[Document]

Creates a change stream for this collection.

Creates a change stream for this collection.

Value 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 observable

Note:

Requires MongoDB 4.0 or greater

def withCodecRegistry(codecRegistry: CodecRegistry): Service

Create a new MongoDatabase instance with a different codec registry.

Create a new MongoDatabase instance with a different codec registry.

Value parameters:
codecRegistry

the new { @link org.bson.codecs.configuration.CodecRegistry} for the collection

Returns:

a new MongoDatabase instance with the different codec registry

Create a new MongoDatabase instance with a different read concern.

Create a new MongoDatabase instance with a different read concern.

Value parameters:
readConcern

the new ReadConcern for the collection

Returns:

a new MongoDatabase instance with the different ReadConcern

Create a new MongoDatabase instance with a different read preference.

Create a new MongoDatabase instance with a different read preference.

Value parameters:
readPreference

the new { @link com.mongodb.ReadPreference} for the collection

Returns:

a new MongoDatabase instance with the different readPreference

Create a new MongoDatabase instance with a different write concern.

Create a new MongoDatabase instance with a different write concern.

Value parameters:
writeConcern

the new { @link com.mongodb.WriteConcern} for the collection

Returns:

a new MongoDatabase instance with the different writeConcern

Get the write concern for the MongoDatabase.

Get the write concern for the MongoDatabase.

Returns:

the { @link com.mongodb.WriteConcern}