MongoZioCollection

case class MongoZioCollection[T](wrapped: MongoCollection[T])
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any

Value members

Concrete methods

def aggregate(pipeline: Seq[Bson])(using ct: ClassTag[T]): ZStream[Any, Throwable, T]

Aggregates documents according to the specified aggregation pipeline.

Aggregates documents according to the specified aggregation pipeline.

def aggregate(clientSession: ClientSession, pipeline: Seq[Bson])(using ct: ClassTag[T]): ZStream[Any, Throwable, T]

Aggregates documents according to the specified aggregation pipeline.

Aggregates documents according to the specified aggregation pipeline.

def bulkWrite(requests: Seq[_ <: WriteModel[_ <: T]]): Task[BulkWriteResult]

Executes a mix of inserts, updates, replaces, and deletes.

Executes a mix of inserts, updates, replaces, and deletes.

def bulkWrite(requests: Seq[_ <: WriteModel[_ <: T]], options: BulkWriteOptions): Task[BulkWriteResult]

Executes a mix of inserts, updates, replaces, and deletes.

Executes a mix of inserts, updates, replaces, and deletes.

def bulkWrite(clientSession: ClientSession, requests: Seq[_ <: WriteModel[_ <: T]]): Task[BulkWriteResult]

Executes a mix of inserts, updates, replaces, and deletes.

Executes a mix of inserts, updates, replaces, and deletes.

def bulkWrite(clientSession: ClientSession, requests: Seq[_ <: WriteModel[_ <: T]], options: BulkWriteOptions): Task[BulkWriteResult]

Executes a mix of inserts, updates, replaces, and deletes.

Executes a mix of inserts, updates, replaces, and deletes.

def countDocuments(): ZIO[Any, Throwable, Long]

Counts the number of documents in the collection.

Counts the number of documents in the collection.

def countDocuments(filter: Bson): ZIO[Any, Throwable, Long]

Counts the number of documents in the collection according to the given options.

Counts the number of documents in the collection according to the given options.

def countDocuments(filter: Bson, options: CountOptions): ZIO[Any, Throwable, Long]

Counts the number of documents in the collection according to the given options.

Counts the number of documents in the collection according to the given options.

def countDocuments(clientSession: ClientSession): ZIO[Any, Throwable, Long]

Counts the number of documents in the collection.

Counts the number of documents in the collection.

def countDocuments(clientSession: ClientSession, filter: Bson): ZIO[Any, Throwable, Long]

Counts the number of documents in the collection according to the given options.

Counts the number of documents in the collection according to the given options.

def countDocuments(clientSession: ClientSession, filter: Bson, options: CountOptions): ZIO[Any, Throwable, Long]

Counts the number of documents in the collection according to the given options.

Counts the number of documents in the collection according to the given options.

def createIndex(key: Bson): Task[String]

Creates an index

Creates an index

def createIndex(key: Bson, options: IndexOptions): Task[String]

Creates an index

Creates an index

def createIndex(clientSession: ClientSession, key: Bson): Task[String]

Creates an index

Creates an index

def createIndex(clientSession: ClientSession, key: Bson, options: IndexOptions): Task[String]

Creates an index

Creates an index

def createIndexes(models: Seq[IndexModel]): Task[String]

Creates an index

Creates an index

def createIndexes(models: Seq[IndexModel], createIndexOptions: CreateIndexOptions): Task[String]

Create multiple indexes.

Create multiple indexes.

def createIndexes(clientSession: ClientSession, models: Seq[IndexModel]): Task[String]

Create multiple indexes.

Create multiple indexes.

def createIndexes(clientSession: ClientSession, models: Seq[IndexModel], createIndexOptions: CreateIndexOptions): Task[String]

Create multiple indexes.

Create multiple indexes.

def deleteMany(filter: Bson): Task[DeleteResult]

Removes all documents from the collection that match the given query filter. If no documents match, the collection is not modified.

Removes all documents from the collection that match the given query filter. If no documents match, the collection is not modified.

def deleteMany(filter: Bson, options: DeleteOptions): Task[DeleteResult]

Removes all documents from the collection that match the given query filter. If no documents match, the collection is not modified.

Removes all documents from the collection that match the given query filter. If no documents match, the collection is not modified.

def deleteMany(clientSession: ClientSession, filter: Bson): Task[DeleteResult]

Removes all documents from the collection that match the given query filter. If no documents match, the collection is not modified.

Removes all documents from the collection that match the given query filter. If no documents match, the collection is not modified.

def deleteMany(clientSession: ClientSession, filter: Bson, options: DeleteOptions): Task[DeleteResult]

Removes all documents from the collection that match the given query filter. If no documents match, the collection is not modified.

Removes all documents from the collection that match the given query filter. If no documents match, the collection is not modified.

def deleteOne(filter: Bson): Task[DeleteResult]

Removes at most one document from the collection that matches the given filter. If no documents match, the collection is not modified.

Removes at most one document from the collection that matches the given filter. If no documents match, the collection is not modified.

def deleteOne(filter: Bson, options: DeleteOptions): Task[DeleteResult]

Removes at most one document from the collection that matches the given filter. If no documents match, the collection is not modified.

Removes at most one document from the collection that matches the given filter. If no documents match, the collection is not modified.

def deleteOne(clientSession: ClientSession, filter: Bson): Task[DeleteResult]

Removes at most one document from the collection that matches the given filter. If no documents match, the collection is not modified.

Removes at most one document from the collection that matches the given filter. If no documents match, the collection is not modified.

def deleteOne(clientSession: ClientSession, filter: Bson, options: DeleteOptions): Task[DeleteResult]

Removes at most one document from the collection that matches the given filter. If no documents match, the collection is not modified.

Removes at most one document from the collection that matches the given filter. If no documents match, the collection is not modified.

def distinct(fieldName: String)(using ct: ClassTag[T]): ZStream[Any, Throwable, T]

Gets the distinct values of the specified field name.

Gets the distinct values of the specified field name.

def distinct(fieldName: String, filter: Bson)(using ct: ClassTag[T]): ZStream[Any, Throwable, T]

Gets the distinct values of the specified field name.

Gets the distinct values of the specified field name.

def distinct(clientSession: ClientSession, fieldName: String)(using ct: ClassTag[T]): ZStream[Any, Throwable, T]

Gets the distinct values of the specified field name.

Gets the distinct values of the specified field name.

def distinct(clientSession: ClientSession, fieldName: String, filter: Bson)(using ct: ClassTag[T]): ZStream[Any, Throwable, T]

Gets the distinct values of the specified field name.

Gets the distinct values of the specified field name.

def drop(): Task[Completed]

Drops this collection from the Database.

Drops this collection from the Database.

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

Drops this collection from the Database.

Drops this collection from the Database.

def dropIndex(indexName: String): Task[Completed]

Drops the given index.

Drops the given index.

def dropIndex(indexName: String, dropIndexOptions: DropIndexOptions): Task[Completed]

Drops the given index.

Drops the given index.

def dropIndex(keys: Bson): Task[Completed]

Drops the index given the keys used to create it.

Drops the index given the keys used to create it.

def dropIndex(keys: Bson, dropIndexOptions: DropIndexOptions): Task[Completed]

Drops the index given the keys used to create it.

Drops the index given the keys used to create it.

def dropIndex(clientSession: ClientSession, indexName: String): ZIO[Any, Throwable, Void]

Drops the given index.

Drops the given index.

def dropIndex(clientSession: ClientSession, indexName: String, dropIndexOptions: DropIndexOptions): Task[Completed]

Drops the given index.

Drops the given index.

def dropIndex(clientSession: ClientSession, keys: Bson): Task[Completed]

Drops the index given the keys used to create it.

Drops the index given the keys used to create it.

def dropIndex(clientSession: ClientSession, keys: Bson, dropIndexOptions: DropIndexOptions): Task[Completed]

Drops the index given the keys used to create it.

Drops the index given the keys used to create it.

def dropIndexes(): Task[Completed]

Drop all the indexes on this collection, except for the default on _id.

Drop all the indexes on this collection, except for the default on _id.

def dropIndexes(dropIndexOptions: DropIndexOptions): Task[Completed]

Drop all the indexes on this collection, except for the default on _id.

Drop all the indexes on this collection, except for the default on _id.

def dropIndexes(clientSession: ClientSession): Task[Completed]

Drop all the indexes on this collection, except for the default on _id.

Drop all the indexes on this collection, except for the default on _id.

def dropIndexes(clientSession: ClientSession, dropIndexOptions: DropIndexOptions): Task[Completed]

Drop all the indexes on this collection, except for the default on _id.

Drop all the indexes on this collection, except for the default on _id.

def estimatedDocumentCount(): ZIO[Any, Throwable, Long]

Gets an estimate of the count of documents in a collection using collection metadata.

Gets an estimate of the count of documents in a collection using collection metadata.

def estimatedDocumentCount(options: EstimatedDocumentCountOptions): ZIO[Any, Throwable, Long]

Gets an estimate of the count of documents in a collection using collection metadata.

Gets an estimate of the count of documents in a collection using collection metadata.

def find()(using ct: ClassTag[T]): ZStream[Any, Throwable, T]

Finds all documents in the collection.

Finds all documents in the collection.

def find(filter: Bson)(using ct: ClassTag[T]): ZStream[Any, Throwable, T]

Finds all documents in the collection.

Finds all documents in the collection.

def find(clientSession: ClientSession)(using ct: ClassTag[T]): ZStream[Any, Throwable, T]

Finds all documents in the collection.

Finds all documents in the collection.

def find(clientSession: ClientSession, filter: Bson)(using ct: ClassTag[T]): ZStream[Any, Throwable, T]

Finds all documents in the collection.

Finds all documents in the collection.

def findOneAndDelete(filter: Bson): Task[T]

Atomically find a document and remove it.

Atomically find a document and remove it.

def findOneAndDelete(filter: Bson, options: FindOneAndDeleteOptions): Task[T]

Atomically find a document and remove it.

Atomically find a document and remove it.

def findOneAndDelete(clientSession: ClientSession, filter: Bson): Task[T]

Atomically find a document and remove it.

Atomically find a document and remove it.

def findOneAndDelete(clientSession: ClientSession, filter: Bson, options: FindOneAndDeleteOptions): Task[T]

Atomically find a document and remove it.

Atomically find a document and remove it.

def findOneAndReplace(filter: Bson, replacement: T): Task[T]

Atomically find a document and replace it.

Atomically find a document and replace it.

def findOneAndReplace(filter: Bson, replacement: T, options: FindOneAndReplaceOptions): Task[T]

Atomically find a document and replace it.

Atomically find a document and replace it.

def findOneAndReplace(clientSession: ClientSession, filter: Bson, replacement: T): Task[T]

Atomically find a document and replace it.

Atomically find a document and replace it.

def findOneAndReplace(clientSession: ClientSession, filter: Bson, replacement: T, options: FindOneAndReplaceOptions): Task[T]

Atomically find a document and replace it.

Atomically find a document and replace it.

def findOneAndUpdate(filter: Bson, update: Bson): Task[T]

Atomically find a document and update it.

Atomically find a document and update it.

def findOneAndUpdate(filter: Bson, update: Bson, options: FindOneAndUpdateOptions): Task[T]

Atomically find a document and update it.

Atomically find a document and update it.

def findOneAndUpdate(clientSession: ClientSession, filter: Bson, update: Bson): Task[T]

Atomically find a document and update it.

Atomically find a document and update it.

def findOneAndUpdate(clientSession: ClientSession, filter: Bson, update: Bson, options: FindOneAndUpdateOptions): Task[T]

Atomically find a document and update it.

Atomically find a document and update it.

def findOneAndUpdate(filter: Bson, update: Seq[Bson]): Task[T]

Atomically find a document and update it.

Atomically find a document and update it.

def findOneAndUpdate(filter: Bson, update: Seq[Bson], options: FindOneAndUpdateOptions): Task[T]

Atomically find a document and update it.

Atomically find a document and update it.

def findOneAndUpdate(clientSession: ClientSession, filter: Bson, update: Seq[Bson]): Task[T]

Atomically find a document and update it.

Atomically find a document and update it.

def findOneAndUpdate(clientSession: ClientSession, filter: Bson, update: Seq[Bson], options: FindOneAndUpdateOptions): Task[T]

Atomically find a document and update it.

Atomically find a document and update it.

def insertMany(documents: Seq[_ <: T]): Task[InsertManyResult]

Inserts a batch of documents. The preferred way to perform bulk inserts is to use the BulkWrite API. However, when talking with a server < 2.6, using this method will be faster due to constraints in the bulk API related to error handling.

Inserts a batch of documents. The preferred way to perform bulk inserts is to use the BulkWrite API. However, when talking with a server < 2.6, using this method will be faster due to constraints in the bulk API related to error handling.

def insertMany(documents: Seq[_ <: T], options: InsertManyOptions): Task[InsertManyResult]

Inserts a batch of documents. The preferred way to perform bulk inserts is to use the BulkWrite API. However, when talking with a server < 2.6, using this method will be faster due to constraints in the bulk API related to error handling.

Inserts a batch of documents. The preferred way to perform bulk inserts is to use the BulkWrite API. However, when talking with a server < 2.6, using this method will be faster due to constraints in the bulk API related to error handling.

def insertMany(clientSession: ClientSession, documents: Seq[_ <: T]): Task[InsertManyResult]

Inserts a batch of documents. The preferred way to perform bulk inserts is to use the BulkWrite API.

Inserts a batch of documents. The preferred way to perform bulk inserts is to use the BulkWrite API.

def insertMany(clientSession: ClientSession, documents: Seq[_ <: T], options: InsertManyOptions): Task[InsertManyResult]

Inserts a batch of documents. The preferred way to perform bulk inserts is to use the BulkWrite API.

Inserts a batch of documents. The preferred way to perform bulk inserts is to use the BulkWrite API.

def insertOne(document: T): Task[InsertOneResult]

Inserts the provided document. If the document is missing an identifier, the driver should generate one.

Inserts the provided document. If the document is missing an identifier, the driver should generate one.

def insertOne(document: T, options: InsertOneOptions): Task[InsertOneResult]

Inserts the provided document. If the document is missing an identifier, the driver should generate one.

Inserts the provided document. If the document is missing an identifier, the driver should generate one.

def insertOne(clientSession: ClientSession, document: T): Task[InsertOneResult]

Inserts the provided document. If the document is missing an identifier, the driver should generate one.

Inserts the provided document. If the document is missing an identifier, the driver should generate one.

def insertOne(clientSession: ClientSession, document: T, options: InsertOneOptions): Task[InsertOneResult]

Inserts the provided document. If the document is missing an identifier, the driver should generate one.

Inserts the provided document. If the document is missing an identifier, the driver should generate one.

def listIndexes()(using ct: ClassTag[T]): ZStream[Any, Throwable, T]

Get all the indexes in this collection.

Get all the indexes in this collection.

def listIndexes(clientSession: ClientSession)(using ct: ClassTag[T]): ZStream[Any, Throwable, T]

Get all the indexes in this collection.

Get all the indexes in this collection.

def mapReduce(mapFunction: String, reduceFunction: String)(using ct: ClassTag[T]): ZStream[Any, Throwable, T]

Aggregates documents according to the specified map-reduce function.

Aggregates documents according to the specified map-reduce function.

def mapReduce(clientSession: ClientSession, mapFunction: String, reduceFunction: String)(using ct: ClassTag[T]): ZStream[Any, Throwable, T]

Aggregates documents according to the specified map-reduce function.

Aggregates documents according to the specified map-reduce function.

def renameCollection(newCollectionNamespace: MongoNamespace): Task[Completed]

Rename the collection with oldCollectionName to the newCollectionName.

Rename the collection with oldCollectionName to the newCollectionName.

def renameCollection(newCollectionNamespace: MongoNamespace, options: RenameCollectionOptions): Task[Completed]

Rename the collection with oldCollectionName to the newCollectionName.

Rename the collection with oldCollectionName to the newCollectionName.

def renameCollection(clientSession: ClientSession, newCollectionNamespace: MongoNamespace): Task[Completed]

Rename the collection with oldCollectionName to the newCollectionName.

Rename the collection with oldCollectionName to the newCollectionName.

def renameCollection(clientSession: ClientSession, newCollectionNamespace: MongoNamespace, options: RenameCollectionOptions): Task[Completed]

Rename the collection with oldCollectionName to the newCollectionName.

Rename the collection with oldCollectionName to the newCollectionName.

Rename collection

Value parameters:
clientSession

the client session with which to associate this operation

newCollectionNamespace

the name the collection will be renamed to

options

the options for renaming a collection

Returns:

an IO with a single element indicating when the operation has completed

Since:

2.2

Note:

Requires MongoDB 3.6 or greater

def replaceOne(filter: Bson, replacement: T): Task[UpdateResult]

Replace a document in the collection according to the specified arguments.

Replace a document in the collection according to the specified arguments.

def replaceOne(clientSession: ClientSession, filter: Bson, replacement: T): Task[UpdateResult]

Replace a document in the collection according to the specified arguments.

Replace a document in the collection according to the specified arguments.

def replaceOne(filter: Bson, replacement: T, options: ReplaceOptions): Task[UpdateResult]

Replace a document in the collection according to the specified arguments.

Replace a document in the collection according to the specified arguments.

def replaceOne(clientSession: ClientSession, filter: Bson, replacement: T, options: ReplaceOptions): Task[UpdateResult]

Replace a document in the collection according to the specified arguments.

Replace a document in the collection according to the specified arguments.

def updateMany(filter: Bson, update: Bson): Task[UpdateResult]

Update a single document in the collection according to the specified arguments.

Update a single document in the collection according to the specified arguments.

def updateMany(filter: Bson, update: Bson, options: UpdateOptions): Task[UpdateResult]

Update a single document in the collection according to the specified arguments.

Update a single document in the collection according to the specified arguments.

def updateMany(clientSession: ClientSession, filter: Bson, update: Bson): Task[UpdateResult]

Update a single document in the collection according to the specified arguments.

Update a single document in the collection according to the specified arguments.

def updateMany(clientSession: ClientSession, filter: Bson, update: Bson, options: UpdateOptions): Task[UpdateResult]

Update a single document in the collection according to the specified arguments.

Update a single document in the collection according to the specified arguments.

def updateMany(filter: Bson, update: Seq[Bson]): Task[UpdateResult]

Update a single document in the collection according to the specified arguments.

Update a single document in the collection according to the specified arguments.

def updateMany(filter: Bson, update: Seq[Bson], options: UpdateOptions): Task[UpdateResult]

Update a single document in the collection according to the specified arguments.

Update a single document in the collection according to the specified arguments.

def updateMany(clientSession: ClientSession, filter: Bson, update: Seq[Bson]): Task[UpdateResult]

Update a single document in the collection according to the specified arguments.

Update a single document in the collection according to the specified arguments.

def updateMany(clientSession: ClientSession, filter: Bson, update: Seq[Bson], options: UpdateOptions): Task[UpdateResult]

Update a single document in the collection according to the specified arguments.

Update a single document in the collection according to the specified arguments.

def updateOne(filter: Bson, update: Bson): Task[UpdateResult]

Update a single document in the collection according to the specified arguments.

Update a single document in the collection according to the specified arguments.

def updateOne(filter: Bson, update: Bson, options: UpdateOptions): Task[UpdateResult]

Update a single document in the collection according to the specified arguments.

Update a single document in the collection according to the specified arguments.

def updateOne(clientSession: ClientSession, filter: Bson, update: Bson): Task[UpdateResult]

Update a single document in the collection according to the specified arguments.

Update a single document in the collection according to the specified arguments.

def updateOne(clientSession: ClientSession, filter: Bson, update: Bson, options: UpdateOptions): Task[UpdateResult]

Update a single document in the collection according to the specified arguments.

Update a single document in the collection according to the specified arguments.

def updateOne(filter: Bson, update: Seq[Bson]): Task[UpdateResult]

Update a single document in the collection according to the specified arguments.

Update a single document in the collection according to the specified arguments.

def updateOne(filter: Bson, update: Seq[Bson], options: UpdateOptions): Task[UpdateResult]

Update a single document in the collection according to the specified arguments.

Update a single document in the collection according to the specified arguments.

def updateOne(clientSession: ClientSession, filter: Bson, update: Seq[Bson]): Task[UpdateResult]

Update a single document in the collection according to the specified arguments.

Update a single document in the collection according to the specified arguments.

def updateOne(clientSession: ClientSession, filter: Bson, update: Seq[Bson], options: UpdateOptions): Task[UpdateResult]

Update a single document in the collection according to the specified arguments.

Update a single document in the collection according to the specified arguments.

def watch(): ZStream[Any, Throwable, ChangeStreamDocument[Document]]

Creates a change stream for this collection.

Creates a change stream for this collection.

Type parameters:
C

the target document type of the observable.

Returns:

the change stream observable

Since:

2.2

Note:

Requires MongoDB 3.6 or greater

def watch(pipeline: Seq[Bson]): ZStream[Any, Throwable, ChangeStreamDocument[Document]]

Creates a change stream for this collection.

Creates a change stream for this collection.

Type parameters:
C

the target document type of the observable.

Value parameters:
pipeline

the aggregation pipeline to apply to the change stream

Returns:

the change stream observable

Since:

2.2

Note:

Requires MongoDB 3.6 or greater

def watch(clientSession: ClientSession): ZStream[Any, Throwable, ChangeStreamDocument[Document]]

Creates a change stream for this collection.

Creates a change stream for this collection.

Type parameters:
C

the target document type of the observable.

Value parameters:
clientSession

the client session with which to associate this operation

Returns:

the change stream observable

Since:

2.2

Note:

Requires MongoDB 3.6 or greater

def watch(clientSession: ClientSession, pipeline: Seq[Bson]): ZStream[Any, Throwable, ChangeStreamDocument[Document]]

Creates a change stream for this collection.

Creates a change stream for this collection.

Type parameters:
C

the target document type of the observable.

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

Since:

2.2

Note:

Requires MongoDB 3.6 or greater

def withCodecRegistry(codecRegistry: CodecRegistry): MongoZioCollection[T]

Create a new MongoZioCollection instance with a different codec registry.

Create a new MongoZioCollection instance with a different codec registry.

def withDocumentClass()(using ct: ClassTag[T]): MongoZioCollection[T]

Create a new MongoZioCollection instance with a different default class to cast any documents returned from the database into..

Create a new MongoZioCollection instance with a different default class to cast any documents returned from the database into..

def withReadConcern(readConcern: ReadConcern): MongoZioCollection[T]

Create a new MongoZioCollection instance with a different read concern.

Create a new MongoZioCollection instance with a different read concern.

def withReadPreference(readPreference: ReadPreference): MongoZioCollection[T]

Create a new MongoZioCollection instance with a different read preference.

Create a new MongoZioCollection instance with a different read preference.

def withWriteConcern(writeConcern: WriteConcern): MongoZioCollection[T]

Create a new MongoZioCollection instance with a different write concern.

Create a new MongoZioCollection instance with a different write concern.

Inherited methods

def productElementNames: Iterator[String]
Inherited from:
Product
def productIterator: Iterator[Any]
Inherited from:
Product

Concrete fields

lazy val codecRegistry: CodecRegistry

Get the codec registry for the MongoDatabase.

Get the codec registry for the MongoDatabase.

lazy val documentClass: Class[T]

Get the default class to cast any documents returned from the database into.

Get the default class to cast any documents returned from the database into.

lazy val namespace: MongoNamespace

Gets the namespace of this collection.

Gets the namespace of this collection.

lazy val readConcern: ReadConcern

Get the read concern for the MongoDatabase.

Get the read concern for the MongoDatabase.

lazy val readPreference: ReadPreference

Get the read preference for the MongoDatabase.

Get the read preference for the MongoDatabase.

lazy val writeConcern: WriteConcern

Get the write concern for the MongoDatabase.

Get the write concern for the MongoDatabase.