MongoDatabase

io.github.zeal18.zio.mongodb.driver.MongoDatabase
See theMongoDatabase companion object

Attributes

Companion:
object
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Concise view

Value members

Abstract methods

Aggregates documents according to the specified aggregation pipeline.

Aggregates documents according to the specified aggregation pipeline.

Attributes

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.

Attributes

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.

Attributes

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

Attributes

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

Attributes

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

Attributes

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

Attributes

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

Attributes

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

Attributes

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

Attributes

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

Attributes

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

Attributes

Returns:

a Observable identifying when the database has been dropped

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

Drops this database.

Drops this database.

Drop database

Attributes

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]): MongoCollection[A]

Gets a collection, with a specific default document class.

Gets a collection, with a specific default document class.

Attributes

TResult

the type of the class to use instead of Document.

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.

Attributes

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.

Attributes

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

Attributes

Returns:

the fluent list collections interface

Finds all the collections in this database.

Finds all the collections in this database.

listCollections

Attributes

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.

Attributes

Returns:

the database name

Get the read concern for the MongoDatabase.

Get the read concern for the MongoDatabase.

Attributes

Returns:

the ReadConcern

Get the read preference for the MongoDatabase.

Get the read preference for the MongoDatabase.

Attributes

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.

Attributes

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.

Attributes

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.

Attributes

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.

Attributes

TResult

the type of the class to use instead of Document.

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(): ZIO[Scope, Throwable, ClientSession]

Creates a client session.

Creates a client session.

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

Attributes

Note:

Requires MongoDB 3.6 or greater

def startSession(options: ClientSessionOptions): ZIO[Scope, Throwable, ClientSession]

Creates a client session.

Creates a client session.

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

Attributes

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.

Attributes

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.

Attributes

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.

Attributes

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.

Attributes

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): MongoDatabase

Create a new MongoDatabase instance with a different codec registry.

Create a new MongoDatabase instance with a different codec registry.

Attributes

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.

Attributes

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.

Attributes

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.

Attributes

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.

Attributes

Returns:

the { @link com.mongodb.WriteConcern}