Class/Object

reactivemongo.api.collections.bson

BSONCollection

Related Docs: object BSONCollection | package bson

Permalink

final class BSONCollection extends Product with GenericCollection[BSONSerializationPack.type] with Serializable with Serializable

Annotations
@deprecated @SerialVersionUID()
Deprecated

(Since version 0.19.0) Use reactivemongo.api.bson.collection.BSONCollection

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. BSONCollection
  2. Serializable
  3. Serializable
  4. GenericCollection
  5. HintFactory
  6. GenericCollectionWithQueryBuilder
  7. GenericCollectionMetaCommands
  8. Aggregator
  9. ChangeStreamOps
  10. FindAndModifyOps
  11. GenericCollectionWithDistinctOps
  12. DistinctOp
  13. DistinctOpCompat
  14. CountOp
  15. DeleteOps
  16. UpdateOps
  17. InsertOps
  18. ImplicitCommandHelpers
  19. CollectionMetaCommands
  20. GenericCollectionWithCommands
  21. Collection
  22. Product
  23. Equals
  24. AnyRef
  25. Any
Implicitly
  1. by any2stringadd
  2. by StringFormat
  3. by Ensuring
  4. by ArrowAssoc
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new BSONCollection(db: DB, name: String, failoverStrategy: FailoverStrategy, readPreference: ReadPreference)

    Permalink
    Annotations
    @deprecated
    Deprecated

    (Since version 0.17.0) Internal: will be made private

Type Members

  1. type AggregationFramework = AggregationFramework.type

    Permalink

    Alias for type of the aggregation framework, depending on the type of the collection.

    Alias for type of the aggregation framework, depending on the type of the collection.

    Definition Classes
    GenericCollection
    See also

    reactivemongo.api.commands.AggregationFramework

  2. final class Aggregator[T, AC[_] <: Cursor[_]] extends AnyRef

    Permalink
    Definition Classes
    Aggregator
  3. final class AggregatorContext[T] extends AnyRef

    Permalink

  4. final class CollectionQueryBuilder extends GenericQueryBuilder[GenericCollection.pack.type]

    Permalink
    Attributes
    protected
    Definition Classes
    GenericCollectionWithQueryBuilder
  5. sealed trait DeleteBuilder extends AnyRef

    Permalink

    Builder for delete operations.

    Builder for delete operations.

    Definition Classes
    DeleteOps
  6. case class DistinctResult extends Product with Serializable

    Permalink

    Attributes
    protected
    Definition Classes
    DistinctOp
  7. trait ImplicitlyDocumentProducer extends AnyRef

    Permalink
    Definition Classes
    ImplicitCommandHelpers
  8. sealed trait InsertBuilder extends AnyRef

    Permalink

    Builder for insert operations.

    Builder for insert operations.

    Definition Classes
    InsertOps
  9. type PipelineOperator = commands.bson.BSONAggregationFramework.PipelineOperator

    Permalink

    Alias for reactivemongo.api.commands.AggregationFramework.PipelineOperator

  10. sealed trait UpdateBuilder extends AnyRef

    Permalink

    Builder for update operations.

    Builder for update operations.

    Definition Classes
    UpdateOps
  11. sealed trait WatchBuilder[T] extends AnyRef

    Permalink

    A builder for the watch collection helper, which allows to consume the collection's ChangeStream.

    A builder for the watch collection helper, which allows to consume the collection's ChangeStream.

    Definition Classes
    ChangeStreamOps

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. def +(other: String): String

    Permalink
    Implicit information
    This member is added by an implicit conversion from BSONCollection to any2stringadd[BSONCollection] performed by method any2stringadd in scala.Predef.
    Definition Classes
    any2stringadd
  4. def ->[B](y: B): (BSONCollection, B)

    Permalink
    Implicit information
    This member is added by an implicit conversion from BSONCollection to ArrowAssoc[BSONCollection] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc
    Annotations
    @inline()
  5. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  6. val BatchCommands: BSONBatchCommands.type

    Permalink
    Definition Classes
    BSONCollectionGenericCollection
  7. object ImplicitlyDocumentProducer

    Permalink
    Definition Classes
    ImplicitCommandHelpers
  8. def MissingMetadata(): ConnectionNotInitialized

    Permalink
    Attributes
    protected
    Definition Classes
    GenericCollection
    Annotations
    @inline()
  9. object UpdateCommand extends UpdateCommand[pack.type]

    Permalink
    Definition Classes
    UpdateOps
    Annotations
    @silent( ... )
  10. def aggregateWith[T](explain: Boolean = false, allowDiskUse: Boolean = false, bypassDocumentValidation: Boolean = false, readConcern: Option[ReadConcern] = None, readPreference: ReadPreference = ReadPreference.primary, batchSize: Option[Int] = None)(f: (AggregationFramework) ⇒ commands.bson.BSONAggregationFramework.Pipeline)(implicit reader: Reader[T], cp: CursorProducer[T]): ProducedCursor

    Permalink

    Aggregates the matching documents.

    Aggregates the matching documents.

    T

    The type of the result elements. An implicit Reader[T] typeclass for handling it has to be in the scope.

    explain

    if true indicates to return the information on the processing of the pipeline

    allowDiskUse

    if true enables writing to temporary files

    bypassDocumentValidation

    if true enables to bypass document validation during the operation

    readConcern

    the read concern

    readPreference

    the read preference for the result (default: primary)

    batchSize

    the batch size (for the aggregation cursor; if None use the default one)

    f

    the function to create the aggregation pipeline using the aggregation framework depending on the collection type

    reader

    the result reader

    Definition Classes
    GenericCollection
  11. lazy val aggregationFramework: AggregationFramework

    Permalink
    Definition Classes
    GenericCollection
  12. def aggregatorContext[T](firstOperator: PipelineOperator, otherOperators: List[PipelineOperator], explain: Boolean, allowDiskUse: Boolean, bypassDocumentValidation: Boolean, readConcern: ReadConcern, readPreference: ReadPreference, writeConcern: commands.WriteConcern, batchSize: Option[Int], cursorOptions: CursorOptions, maxTime: Option[FiniteDuration], hint: Option[Hint[pack.type]], comment: Option[String], collation: Option[Collation])(implicit reader: Reader[T]): AggregatorContext[T]

    Permalink

    Aggregates the matching documents.

    Aggregates the matching documents.

    import scala.concurrent.Future
    import scala.concurrent.ExecutionContext.Implicits.global
    
    import reactivemongo.api.Cursor
    import reactivemongo.api.bson._
    import reactivemongo.api.bson.collection.BSONCollection
    
    def populatedStates(cities: BSONCollection): Future[List[BSONDocument]] = {
      import cities.aggregationFramework
      import aggregationFramework.{ Group, Match, SumField }
    
      cities.aggregatorContext[BSONDocument](
        Group(BSONString(f"$$state"))(
          "totalPop" -> SumField("population")), List(
            Match(BSONDocument("totalPop" ->
              BSONDocument(f"$$gte" -> 10000000L))))
      ).prepared.cursor.collect[List](
        maxDocs = 3,
        err = Cursor.FailOnError[List[BSONDocument]]()
      )
    }
    T

    The type of the result elements. An implicit Reader[T] typeclass for handling it has to be in the scope.

    firstOperator

    the first aggregation operator of the pipeline

    otherOperators

    the sequence of MongoDB aggregation operations

    explain

    if true indicates to return the information on the processing of the pipeline

    allowDiskUse

    if true enables writing to temporary files

    bypassDocumentValidation

    if true enables to bypass document validation during the operation

    readConcern

    the read concern

    readPreference

    the read preference for the result

    writeConcern

    the writer concern to be used

    batchSize

    the batch size (for the aggregation cursor; if None use the default one)

    cursorOptions

    the options for the result cursor

    maxTime

    the time limit for processing operations on a cursor (maxTimeMS)

    hint

    the index to use (either the index name or the index document)

    comment

    the comment to annotation the aggregation command

    collation

    the collation

    reader

    the result reader

    Definition Classes
    GenericCollection
  13. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  14. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  15. def convertToCapped(size: Long, maxDocuments: Option[Int])(implicit ec: ExecutionContext): Future[Unit]

    Permalink

    Converts this collection to a capped one.

    Converts this collection to a capped one.

    import scala.concurrent.{ ExecutionContext, Future }
    
    def capColl(coll: reactivemongo.api.bson.collection.BSONCollection)(
      implicit ec: ExecutionContext): Future[Unit] =
      coll.convertToCapped(size = 10L, maxDocuments = Some(100))
    size

    the size of the collection (number of bytes)

    maxDocuments

    the maximum number of documents this capped collection can contain

    Definition Classes
    CollectionMetaCommands
  16. def count(selector: Option[Document], limit: Option[Int], skip: Int, hint: Option[Hint[pack.type]], readConcern: ReadConcern, readPreference: ReadPreference)(implicit ec: ExecutionContext): Future[Long]

    Permalink

    Counts the matching documents.

    Counts the matching documents.

    selector

    the document selector

    limit

    the maximum number of matching documents to count

    skip

    the number of matching documents to skip before counting

    hint

    the index to use (either the index name or the index document; see hint(..))

    readConcern

    the read concern

    readPreference

    the read preference for the result

    Definition Classes
    GenericCollection
    See also

    MongoDB documentation

  17. def count(selector: Option[Document], limit: Option[Int], skip: Int, hint: Option[Hint[pack.type]], readConcern: ReadConcern)(implicit ec: ExecutionContext): Future[Long]

    Permalink

    Counts the matching documents.

    Counts the matching documents.

    selector

    the document selector

    limit

    the maximum number of matching documents to count

    skip

    the number of matching documents to skip before counting

    hint

    the index to use (either the index name or the index document; see hint(..))

    readConcern

    the read concern

    Definition Classes
    GenericCollection
    See also

    MongoDB documentation

  18. def countDocuments(query: Option[Document], limit: Option[Int], skip: Int, hint: Option[Hint[pack.type]], readConcern: ReadConcern, readPreference: ReadPreference)(implicit ec: ExecutionContext): Future[Long]

    Permalink
    Attributes
    protected
    Definition Classes
    CountOp
  19. def create(failsIfExists: Boolean = false)(implicit ec: ExecutionContext): Future[Unit]

    Permalink

    Creates this collection.

    Creates this collection.

    import scala.concurrent.{ ExecutionContext, Future }
    import reactivemongo.api.CollectionMetaCommands
    
    def createIfNotExists(coll: CollectionMetaCommands)(
      implicit ec: ExecutionContext): Future[Unit] =
      coll.create(failsIfExists = true)
    failsIfExists

    if true fails if the collection already exists (default: false)

    Definition Classes
    CollectionMetaCommands
  20. def create()(implicit ec: ExecutionContext): Future[Unit]

    Permalink

    Creates this collection.

    Creates this collection.

    The returned future will be completed, with an error if this collection already exists.

    import scala.concurrent.ExecutionContext
    
    import reactivemongo.api.CollectionMetaCommands
    import reactivemongo.api.commands.CommandError
    
    def createColl(
      coll: CollectionMetaCommands)(implicit ec: ExecutionContext) =
      coll.create().recover {
        case CommandError.Code(48) => // NamespaceExists
          println(s"Collection \${coll} already exists")
      }
    Definition Classes
    CollectionMetaCommands
  21. def createCapped(size: Long, maxDocuments: Option[Int], autoIndexId: Boolean = false)(implicit ec: ExecutionContext): Future[Unit]

    Permalink

    Creates this collection as a capped one.

    Creates this collection as a capped one.

    The returned future will be completed with an error if this collection already exists.

    import scala.concurrent.{ ExecutionContext, Future }
    
    def capped(coll: reactivemongo.api.bson.collection.BSONCollection)(
      implicit ec: ExecutionContext): Future[Unit] =
      coll.createCapped(size = 10, maxDocuments = Some(100))
    size

    the size of the collection (number of bytes)

    maxDocuments

    the maximum number of documents this capped collection can contain

    autoIndexId

    If true should automatically add an index on the _id field. By default, regular collections will have an indexed _id field, in contrast to capped collections. This MongoDB option is deprecated and will be removed in a future release.

    Definition Classes
    CollectionMetaCommands
    See also

    convertToCapped

  22. def createView(name: String, operator: PipelineOperator, pipeline: Seq[PipelineOperator], collation: Option[Collation] = None)(implicit ec: ExecutionContext): Future[Unit]

    Permalink

    Creates a view on this collection, using an aggregation pipeline.

    Creates a view on this collection, using an aggregation pipeline.

    name

    the name of the view to be created

    operator

    the first (required) operator for the aggregation pipeline

    pipeline

    the other pipeline operators

    collation

    the view collation

    Definition Classes
    GenericCollectionMetaCommands
    Since

    MongoDB 3.4

    import scala.concurrent.ExecutionContext
    import reactivemongo.api.bson.{ BSONDocument, BSONString }
    import reactivemongo.api.bson.collection.BSONCollection
    def foo(coll: BSONCollection)(implicit ec: ExecutionContext) = {
      import coll.aggregationFramework
      import aggregationFramework.{ Group, Match, SumField }
      // See http://docs.mongodb.org/manual/tutorial/aggregation-zip-code-data-set/#return-states-with-populations-above-10-million
      // Create 'myview'
      coll.createView(
        name = "myview",
        operator = Group(BSONString(f"$$state"))(
          "totalPop" -> SumField("population")),
        pipeline = Seq(Match(
          BSONDocument("totalPop" -> BSONDocument(f"$$gte" -> 10000000L)))))
      // Then the view can be resolved as any collection
      // (but won't be writeable)
      val view: BSONCollection = coll.db("myview")
    }
  23. val db: DB

    Permalink

    The database which this collection belongs to.

    The database which this collection belongs to.

    Definition Classes
    BSONCollectionCollection
  24. def defaultCursorBatchSize: Int

    Permalink
    Attributes
    protected
    Definition Classes
    GenericCollection
    Annotations
    @inline()
  25. def delete(ordered: Boolean = true, writeConcern: commands.WriteConcern = writeConcern): DeleteBuilder

    Permalink

    Prepares a delete builder.

    Prepares a delete builder.

    ordered

    the ordered behaviour

    writeConcern

    the writer concern to be used

    import scala.concurrent.ExecutionContext
    import reactivemongo.api.bson.BSONDocument
    import reactivemongo.api.bson.collection.BSONCollection
    def foo(coll: BSONCollection, query: BSONDocument)(
      implicit ec: ExecutionContext) = coll.delete(true).one(query)
    Definition Classes
    GenericCollection
  26. def delete: DeleteBuilder

    Permalink

    Prepares an unordered delete builder.

    Prepares an unordered delete builder.

    import scala.concurrent.ExecutionContext
    
    import reactivemongo.api.bson.BSONDocument
    import reactivemongo.api.bson.collection.BSONCollection
    
    def doIt(coll: BSONCollection, query: BSONDocument)(
      implicit ec: ExecutionContext) = coll.delete.one(query)
    
    def equivalentTo(coll: BSONCollection) = coll.delete(false)
    Definition Classes
    GenericCollection
  27. def distinct[T, M[_] <: Iterable[_]](key: String, selector: Option[Document], readConcern: ReadConcern, collation: Option[Collation])(implicit reader: NarrowValueReader[T], ec: ExecutionContext, cbf: CanBuildFrom[M[_], T, M[T]]): Future[M[T]]

    Permalink

    Returns the distinct values for a specified field across a single collection.

    Returns the distinct values for a specified field across a single collection.

    T

    the element type of the distinct values

    M

    the container, that must be a scala.collection.Iterable

    key

    the field for which to return distinct values

    selector

    the document selector, that specifies the documents from which to retrieve the distinct values.

    readConcern

    the read concern

    collation

    the collation

    import scala.concurrent.ExecutionContext
    import reactivemongo.api.ReadConcern
    import reactivemongo.api.bson.collection.BSONCollection
    def distinctStates(coll: BSONCollection)(implicit ec: ExecutionContext) =
      coll.distinct[String, Set]("state", None, ReadConcern.Local, None)
    Definition Classes
    GenericCollectionWithDistinctOps
  28. def distinctDocuments[T, M[_] <: Iterable[_]](key: String, query: Option[Document], readConcern: ReadConcern, collation: Option[Collation], builder: Builder[T, M[T]])(implicit reader: NarrowValueReader[T], ec: ExecutionContext): Future[M[T]]

    Permalink
    Attributes
    protected
    Definition Classes
    DistinctOp
  29. final def distinctDocuments[T, M[_] <: Iterable[_]](key: String, query: Option[Document], readConcern: ReadConcern, collation: Option[Collation])(implicit reader: NarrowValueReader[T], ec: ExecutionContext, cbf: CanBuildFrom[M[_], T, M[T]]): Future[M[T]]

    Permalink
    Attributes
    protected
    Definition Classes
    DistinctOpCompat
  30. def drop(failIfNotFound: Boolean)(implicit ec: ExecutionContext): Future[Boolean]

    Permalink

    Drops this collection.

    Drops this collection.

    If the collection existed and is successfully dropped, the returned future will be completed with true.

    If failIfNotFound is false and the collection doesn't exist, the returned future will be completed with false.

    Otherwise in case, the future will be completed with the encountered error.

    import scala.concurrent.{ ExecutionContext, Future }
    import reactivemongo.api.CollectionMetaCommands
    
    def dropIfNotFound(coll: CollectionMetaCommands)(
      implicit ec: ExecutionContext): Future[Boolean] =
      coll.drop(failIfNotFound = true)
    failIfNotFound

    the flag to request whether it should fail

    Definition Classes
    CollectionMetaCommands
    Annotations
    @silent( ".*DropCollectionResult.*" )
  31. def ensuring(cond: (BSONCollection) ⇒ Boolean, msg: ⇒ Any): BSONCollection

    Permalink
    Implicit information
    This member is added by an implicit conversion from BSONCollection to Ensuring[BSONCollection] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  32. def ensuring(cond: (BSONCollection) ⇒ Boolean): BSONCollection

    Permalink
    Implicit information
    This member is added by an implicit conversion from BSONCollection to Ensuring[BSONCollection] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  33. def ensuring(cond: Boolean, msg: ⇒ Any): BSONCollection

    Permalink
    Implicit information
    This member is added by an implicit conversion from BSONCollection to Ensuring[BSONCollection] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  34. def ensuring(cond: Boolean): BSONCollection

    Permalink
    Implicit information
    This member is added by an implicit conversion from BSONCollection to Ensuring[BSONCollection] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  35. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  36. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  37. val failoverStrategy: FailoverStrategy

    Permalink

    The default failover strategy for the methods of this collection.

    The default failover strategy for the methods of this collection.

    Definition Classes
    BSONCollectionCollection
  38. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  39. def find[S, J](selector: S, projection: Option[J] = Option.empty)(implicit swriter: Writer[S], pwriter: Writer[J]): GenericQueryBuilder[pack.type]

    Permalink

    Finds the documents matching the given criteria (selector), with the projection applied.

    Finds the documents matching the given criteria (selector), with the projection applied.

    S

    The type of the selector. An implicit Writer[S] typeclass for handling it has to be in the scope.

    selector

    the document selector

    projection

    the projection document to select only a subset of each matching documents

    swriter

    the writer for the selector

    pwriter

    the writer for the projection

    returns

    A GenericQueryBuilder that you can use to to customize the query. You can obtain a cursor by calling the method reactivemongo.api.Cursor on this query builder.

    Definition Classes
    GenericCollection
    See also

    MongoDB documentation

  40. def findAndModify[S](selector: S, modifier: commands.bson.BSONFindAndModifyCommand.Modify, sort: Option[Document], fields: Option[Document], bypassDocumentValidation: Boolean, writeConcern: commands.WriteConcern, maxTime: Option[FiniteDuration], collation: Option[Collation], arrayFilters: Seq[Document])(implicit swriter: Writer[S], ec: ExecutionContext): Future[Result[pack.type]]

    Permalink

    Applies a findAndModify operation.

    Applies a findAndModify operation. See findAndUpdate and findAndRemove convenient functions.

    import scala.concurrent.{ ExecutionContext, Future }
    
    import reactivemongo.api.bson.{ BSONDocument, BSONDocumentReader }
    import reactivemongo.api.bson.collection.BSONCollection
    
    case class Person(name: String, age: Int)
    
    def foo(coll: BSONCollection)(
      implicit ec: ExecutionContext, r: BSONDocumentReader[Person]) = {
      val updateOp = coll.updateModifier(
        BSONDocument(f"$$set" -> BSONDocument("age" -> 35)))
    
      val personBeforeUpdate: Future[Option[Person]] =
        coll.findAndModify(BSONDocument("name" -> "Joline"), updateOp).
        map(_.result[Person])
    
      val removedPerson: Future[Option[Person]] = coll.findAndModify(
        BSONDocument("name" -> "Jack"), coll.removeModifier).
        map(_.result[Person])
    }
    selector

    the document selector

    modifier

    the modify operator to be applied

    sort

    the document indicating the sort criteria (default: None)

    fields

    the projection fields

    writeConcern

    the writer concern to be used

    maxTime

    the time limit for processing operations on a cursor (maxTimeMS)

    collation

    the collation

    arrayFilters

    an array of filter documents that determines which array elements to modify for an update operation on an array field

    swriter

    the writer for the selector

    Definition Classes
    GenericCollection
  41. def findAndRemove[S](selector: S, sort: Option[Document], fields: Option[Document], writeConcern: commands.WriteConcern, maxTime: Option[FiniteDuration], collation: Option[Collation], arrayFilters: Seq[Document])(implicit swriter: Writer[S], ec: ExecutionContext): Future[Result[pack.type]]

    Permalink

    Finds some matching document, and removes it (using findAndModify).

    Finds some matching document, and removes it (using findAndModify).

    import scala.concurrent.{ ExecutionContext, Future }
    
    import reactivemongo.api.bson.{ BSONDocument, BSONDocumentReader }
    import reactivemongo.api.bson.collection.BSONCollection
    
    case class Person(name: String, age: Int)
    
    def removed(coll: BSONCollection)(
      implicit ec: ExecutionContext,
      r: BSONDocumentReader[Person]): Future[Option[Person]] =
      coll.findAndRemove(
        BSONDocument("name" -> "Foo")).map(_.result[Person])
    S

    The type of the selector. An implicit Writer[S] typeclass for handling it has to be in the scope.

    selector

    the document selector

    sort

    the document indicating the sort criteria

    fields

    the projection fields

    writeConcern

    the writer concern to be used

    maxTime

    the time limit for processing operations on a cursor (maxTimeMS)

    collation

    the collation

    arrayFilters

    an array of filter documents that determines which array elements to modify for an update operation on an array field

    swriter

    the writer for the selector

    Definition Classes
    GenericCollection
  42. def findAndUpdate[S, T](selector: S, update: T, fetchNewObject: Boolean, upsert: Boolean, sort: Option[Document], fields: Option[Document], bypassDocumentValidation: Boolean, writeConcern: commands.WriteConcern, maxTime: Option[FiniteDuration], collation: Option[Collation], arrayFilters: Seq[Document])(implicit swriter: Writer[S], writer: Writer[T], ec: ExecutionContext): Future[Result[pack.type]]

    Permalink

    Finds some matching document, and updates it (using findAndModify).

    Finds some matching document, and updates it (using findAndModify).

    import scala.concurrent.{ ExecutionContext, Future }
    
    import reactivemongo.api.bson.BSONDocument
    import reactivemongo.api.bson.collection.BSONCollection
    
    def findPerson(coll: BSONCollection)(
      implicit ec: ExecutionContext): Future[Option[BSONDocument]] =
      coll.findAndUpdate(
        BSONDocument("name" -> "James"),
        BSONDocument(f"$$set" -> BSONDocument("age" -> 17)),
        fetchNewObject = true).map(_.value)
        // on success, return the update document: { "age": 17 }
    selector

    the document selector

    update

    the update to be applied

    fetchNewObject

    the command result must be the new object instead of the old one.

    upsert

    if true, creates a new document if no document is matching, otherwise if at least one document matches, an update is applied

    sort

    the document indicating the sort criteria (default: None)

    fields

    the projection fields

    writeConcern

    the writer concern to be used

    maxTime

    the time limit for processing operations on a cursor (maxTimeMS)

    collation

    the collation

    arrayFilters

    an array of filter documents that determines which array elements to modify for an update operation on an array field

    swriter

    the writer for the selector

    writer

    the writer to create the document

    Definition Classes
    GenericCollection
  43. def formatted(fmtstr: String): String

    Permalink
    Implicit information
    This member is added by an implicit conversion from BSONCollection to StringFormat[BSONCollection] performed by method StringFormat in scala.Predef.
    Definition Classes
    StringFormat
    Annotations
    @inline()
  44. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  45. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  46. def hint(specification: Document): Hint[pack.type]

    Permalink

    Returns a hint for the given index specification document.

    Returns a hint for the given index specification document.

    specification

    the index specification document

    Definition Classes
    HintFactory
  47. def hint(name: String): Hint[pack.type]

    Permalink

    Returns a hint for the given index name.

    Returns a hint for the given index name.

    name

    the index name

    Definition Classes
    HintFactory
  48. def indexesManager(implicit ec: ExecutionContext): Aux[Pack]

    Permalink

    Returns an index manager for this collection.

    Returns an index manager for this collection.

    import scala.concurrent.{ ExecutionContext, Future }
    import reactivemongo.api.CollectionMetaCommands
    
    def listIndexes(coll: CollectionMetaCommands)(
      implicit ec: ExecutionContext): Future[List[String]] =
      coll.indexesManager.list().map(_.flatMap { idx =>
        idx.name.toList
      })
    Definition Classes
    CollectionMetaCommands
  49. def insert(ordered: Boolean, writeConcern: commands.WriteConcern, bypassDocumentValidation: Boolean): InsertBuilder

    Permalink

    Returns a builder for insert operations.

    Returns a builder for insert operations.

    ordered

    the ordered behaviour

    writeConcern

    the writer concern to be used

    bypassDocumentValidation

    the flag to bypass document validation during the operation

    import scala.concurrent.ExecutionContext
    import reactivemongo.api.WriteConcern
    import reactivemongo.api.bson.BSONDocument
    import reactivemongo.api.bson.collection.BSONCollection
    def withDefaultWriteConcern(coll: BSONCollection, query: BSONDocument)(
      implicit ec: ExecutionContext) =
      coll.insert(true, WriteConcern.Journaled, true).one(query)
    Definition Classes
    GenericCollection
  50. def insert(ordered: Boolean, writeConcern: commands.WriteConcern): InsertBuilder

    Permalink

    Returns a builder for insert operations.

    Returns a builder for insert operations.

    ordered

    the ordered behaviour

    writeConcern

    the writer concern to be used

    import scala.concurrent.ExecutionContext
    import reactivemongo.api.WriteConcern
    import reactivemongo.api.bson.BSONDocument
    import reactivemongo.api.bson.collection.BSONCollection
    def withDefaultWriteConcern(coll: BSONCollection, query: BSONDocument)(
      implicit ec: ExecutionContext) =
      coll.insert(true, WriteConcern.Journaled).one(query)
    Definition Classes
    GenericCollection
  51. def insert(ordered: Boolean): InsertBuilder

    Permalink

    Returns a builder for insert operations.

    Returns a builder for insert operations. Uses the default write concern.

    ordered

    the ordered behaviour

    import scala.concurrent.ExecutionContext
    import reactivemongo.api.bson.BSONDocument
    import reactivemongo.api.bson.collection.BSONCollection
    def one(coll: BSONCollection, singleDoc: BSONDocument)(
      implicit ec: ExecutionContext) =
      coll.insert(ordered = true).one(singleDoc)
    def many(coll: BSONCollection, multiInserts: Iterable[BSONDocument])(
      implicit ec: ExecutionContext) =
      coll.insert(ordered = true).many(multiInserts)
    Definition Classes
    GenericCollection
  52. def insert: InsertBuilder

    Permalink

    Returns an unordered builder for insert operations.

    Returns an unordered builder for insert operations. Uses the default write concern.

    Definition Classes
    GenericCollection
  53. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  54. val name: String

    Permalink

    The name of the collection.

    The name of the collection.

    Definition Classes
    BSONCollectionCollection
  55. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  56. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  57. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  58. val pack: BSONSerializationPack.type

    Permalink
  59. def productIterator: Iterator[Any]

    Permalink
    Definition Classes
    Product
  60. def productPrefix: String

    Permalink
    Definition Classes
    Product
  61. def readConcern: ReadConcern

    Permalink

    The default read concern

    The default read concern

    Attributes
    protected
    Definition Classes
    GenericCollection
    Annotations
    @inline()
  62. val readPreference: ReadPreference

    Permalink

    The default read preference

    The default read preference

    Definition Classes
    BSONCollectionGenericCollection
  63. def runCommand[C <: CollectionCommand](command: C)(implicit writer: Writer[ResolvedCollectionCommand[C]]): CursorFetcher[pack.type, Cursor]

    Permalink
  64. def runCommand[R, C <: CollectionCommand with CommandWithResult[R]](command: C with CommandWithResult[R], readPreference: ReadPreference = self.readPreference)(implicit writer: Writer[ResolvedCollectionCommand[C]], reader: Reader[R], ec: ExecutionContext): Future[R]

    Permalink
  65. def runValueCommand[A <: AnyVal, R <: BoxedAnyVal[A], C <: CollectionCommand with CommandWithResult[R]](command: C with CommandWithResult[R with BoxedAnyVal[A]], rp: ReadPreference = self.readPreference)(implicit writer: Writer[ResolvedCollectionCommand[C]], reader: Reader[R], ec: ExecutionContext): Future[A]

    Permalink
  66. def runWithResponse[R, C <: CollectionCommand with CommandWithResult[R]](command: C with CommandWithResult[R], readPreference: ReadPreference = self.readPreference)(implicit writer: Writer[ResolvedCollectionCommand[C]], reader: Reader[R], ec: ExecutionContext): Future[ResponseResult[R]]

    Permalink
  67. def runner: CommandWithPackRunner[pack.type]

    Permalink
  68. def stats(scale: Int)(implicit ec: ExecutionContext): Future[CollStatsResult]

    Permalink

    Returns various information about this collection.

    Returns various information about this collection.

    import scala.concurrent.{ ExecutionContext, Future }
    
    def getSize(coll: reactivemongo.api.bson.collection.BSONCollection)(
      implicit ec: ExecutionContext): Future[Double] =
      coll.stats(scale = 1024).map(_.size)
    scale

    the scale factor (for example, to get all the sizes in kilobytes)

    Definition Classes
    CollectionMetaCommands
  69. def stats()(implicit ec: ExecutionContext): Future[CollStatsResult]

    Permalink

    Returns various information about this collection.

    Returns various information about this collection.

    import scala.concurrent.{ ExecutionContext, Future }
    
    def isCapped(coll: reactivemongo.api.bson.collection.BSONCollection)(
      implicit ec: ExecutionContext): Future[Boolean] =
      coll.stats().map(_.capped)
    Definition Classes
    CollectionMetaCommands
  70. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  71. lazy val toString: String

    Permalink
    Definition Classes
    BSONCollectionGenericCollection → AnyRef → Any
  72. implicit lazy val unitBoxReader: Reader[UnitBox.type]

    Permalink
    Attributes
    protected
    Definition Classes
    GenericCollection
  73. def update(ordered: Boolean, writeConcern: commands.WriteConcern, bypassDocumentValidation: Boolean): UpdateBuilder

    Permalink

    Returns an update builder.

    Returns an update builder.

    import scala.concurrent.ExecutionContext
    
    import reactivemongo.api.commands.WriteConcern
    import reactivemongo.api.bson.BSONDocument
    import reactivemongo.api.bson.collection.BSONCollection
    
    def withDefaultWriteConcern(
      coll: BSONCollection,
      query: BSONDocument,
      update: BSONDocument,
      wc: WriteConcern
    )(implicit ec: ExecutionContext) = coll.update(
      ordered = false,
      writeConcern = wc,
      bypassDocumentValidation = true
    ).one(query, update)
    ordered

    the ordered behaviour

    writeConcern

    the writer concern to be used

    bypassDocumentValidation

    the flag to bypass document validation during the operation

    Definition Classes
    GenericCollection
  74. def update(ordered: Boolean, writeConcern: commands.WriteConcern): UpdateBuilder

    Permalink

    Returns an update builder.

    Returns an update builder.

    import scala.concurrent.ExecutionContext
    
    import reactivemongo.api.commands.WriteConcern
    import reactivemongo.api.bson.BSONDocument
    import reactivemongo.api.bson.collection.BSONCollection
    
    def withDefaultWriteConcern(
      coll: BSONCollection,
      query: BSONDocument,
      update: BSONDocument,
      wc: WriteConcern
    )(implicit ec: ExecutionContext) =
      coll.update(ordered = false, writeConcern = wc).one(query, update)
    ordered

    the ordered behaviour

    writeConcern

    the writer concern to be used

    Definition Classes
    GenericCollection
  75. def update(ordered: Boolean): UpdateBuilder

    Permalink

    Returns an update builder.

    Returns an update builder.

    import scala.concurrent.ExecutionContext
    
    import reactivemongo.api.bson.BSONDocument
    import reactivemongo.api.bson.collection.BSONCollection
    
    def withDefaultWriteConcern(
      coll: BSONCollection,
      query: BSONDocument,
      update: BSONDocument
    )(implicit ec: ExecutionContext) = {
      coll.update(ordered = true).
        one(query, update, upsert = false, multi = false)
    }
    ordered

    the ordered behaviour

    Definition Classes
    GenericCollection
  76. def update: UpdateBuilder

    Permalink

    Returns an unordered update builder.

    Returns an unordered update builder.

    import scala.concurrent.ExecutionContext
    
    import reactivemongo.api.bson.BSONDocument
    import reactivemongo.api.bson.collection.BSONCollection
    
    def withDefaultWriteConcern(
      coll: BSONCollection,
      query: BSONDocument,
      update: BSONDocument
    )(implicit ec: ExecutionContext) = {
      coll.update.one(query, update, upsert = false, multi = false)
    }
    Definition Classes
    GenericCollection
  77. def updateModifier[U](update: U, fetchNewObject: Boolean = false, upsert: Boolean = false)(implicit updateWriter: Writer[U]): commands.bson.BSONFindAndModifyCommand.Update

    Permalink

    Returns an update modifier, to be used with findAndModify.

    Returns an update modifier, to be used with findAndModify.

    update

    the update to be applied

    fetchNewObject

    the command result must be the new object instead of the old one.

    upsert

    if true, creates a new document if no document is matching, otherwise if at least one document matches, an update is applied

    Definition Classes
    GenericCollection
  78. lazy val version: MongoWireVersion

    Permalink

    Upper MongoDB version (used for version checks)

    Upper MongoDB version (used for version checks)

    Attributes
    protected
    Definition Classes
    GenericCollection
  79. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  80. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  81. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  82. final def watch[T](resumeAfter: Option[Value] = None, startAtOperationTime: Option[Value] = None, pipeline: List[PipelineOperator] = Nil, maxAwaitTimeMS: Option[Long] = None, fullDocumentStrategy: Option[FullDocumentStrategy] = None)(implicit reader: Reader[T]): WatchBuilder[T]

    Permalink

    Prepares a builder for watching the change stream of this collection.

    Prepares a builder for watching the change stream of this collection.

    Note: The target mongo instance MUST be a replica-set (even in the case of a single node deployement).

    import scala.concurrent.{ ExecutionContext, Future }
    
    import reactivemongo.api.Cursor
    import reactivemongo.api.bson.BSONDocument
    import reactivemongo.api.bson.collection.BSONCollection
    
    def events(coll: BSONCollection)(
      implicit ec: ExecutionContext): Cursor[BSONDocument] =
      coll.watch[BSONDocument]().cursor
    T

    the type into which Change Events are deserialized

    resumeAfter

    The id of the last known Change Event, if any. The stream will resume just after that event.

    startAtOperationTime

    The operation time before which all Change Events are known. Must be in the time range of the oplog. (since MongoDB 4.0)

    pipeline

    The sequence of aggregation stages to apply on events in the stream (see MongoDB documentation for a list of valid stages for a change stream).

    maxAwaitTimeMS

    The maximum amount of time in milliseconds the server waits for new data changes before returning an empty batch. In practice, this parameter controls the duration of the long-polling behavior of the cursor.

    fullDocumentStrategy

    if set to UpdateLookup, every update change event will be joined with the current version of the relevant document.

    reader

    the reader of the resulting change events

    Definition Classes
    ChangeStreamOps
    Since

    MongoDB 3.6

  83. def watchFailure[T](future: ⇒ Future[T]): Future[T]

    Permalink
    Attributes
    protected
    Definition Classes
    GenericCollection
  84. def withReadPreference(pref: ReadPreference): BSONCollection

    Permalink

    Returns a new reference to the same collection, with the given read preference.

    Returns a new reference to the same collection, with the given read preference.

    Definition Classes
    BSONCollectionGenericCollection
  85. def writeConcern: commands.WriteConcern

    Permalink

    The default write concern

    The default write concern

    Attributes
    protected
    Definition Classes
    GenericCollection
    Annotations
    @inline()
  86. def writePreference: ReadPreference

    Permalink

    The read preference for the write operations (primary)

    The read preference for the write operations (primary)

    Attributes
    protected
    Definition Classes
    GenericCollection
    Annotations
    @inline()
  87. def [B](y: B): (BSONCollection, B)

    Permalink
    Implicit information
    This member is added by an implicit conversion from BSONCollection to ArrowAssoc[BSONCollection] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc

Deprecated Value Members

  1. object DeleteCommand extends DeleteCommand[pack.type]

    Permalink
    Definition Classes
    DeleteOps
    Annotations
    @deprecated
    Deprecated

    (Since version 0.19.0) Internal: will be made private

  2. implicit def PackIdentityReader: Reader[Document]

    Permalink
    Definition Classes
    GenericCollection
    Annotations
    @deprecated
    Deprecated

    (Since version 0.16.0) Internal: will be made private

  3. implicit def PackIdentityWriter: Writer[Document]

    Permalink
    Definition Classes
    GenericCollection
    Annotations
    @deprecated
    Deprecated

    (Since version 0.16.0) Internal: will be made private

  4. def aggregateWith1[T](explain: Boolean = false, allowDiskUse: Boolean = false, bypassDocumentValidation: Boolean = false, readConcern: Option[ReadConcern] = None, readPreference: ReadPreference = ReadPreference.primary, batchSize: Option[Int] = None)(f: (AggregationFramework) ⇒ commands.bson.BSONAggregationFramework.Pipeline)(implicit ec: ExecutionContext, reader: Reader[T], cf: CursorFlattener[Cursor], cp: CursorProducer[T]): ProducedCursor

    Permalink

    Aggregates the matching documents.

    Aggregates the matching documents.

    T

    The type of the result elements. An implicit Reader[T] typeclass for handling it has to be in the scope.

    explain

    if true indicates to return the information on the processing of the pipeline

    allowDiskUse

    if true enables writing to temporary files

    bypassDocumentValidation

    if true enables to bypass document validation during the operation

    readConcern

    the read concern

    readPreference

    the read preference for the result (default: primary)

    batchSize

    the batch size (for the aggregation cursor; if None use the default one)

    f

    the function to create the aggregation pipeline using the aggregation framework depending on the collection type

    reader

    the result reader

    cf

    the cursor flattener (by default use the builtin one)

    Definition Classes
    GenericCollection
    Annotations
    @deprecated
    Deprecated

    (Since version 0.16.0) Use aggregateWith

  5. def aggregatorContext[T](firstOperator: PipelineOperator, otherOperators: List[PipelineOperator] = Nil, explain: Boolean = false, allowDiskUse: Boolean = false, bypassDocumentValidation: Boolean = false, readConcern: Option[ReadConcern] = None, readPreference: ReadPreference = ReadPreference.primary, writeConcern: commands.WriteConcern = this.writeConcern, batchSize: Option[Int] = None, cursorOptions: CursorOptions = CursorOptions.empty, maxTimeMS: Option[Long] = None)(implicit reader: Reader[T]): AggregatorContext[T]

    Permalink
    Definition Classes
    GenericCollection
    Annotations
    @deprecated @inline()
    Deprecated

    (Since version 0.19.8) Use aggregator context with comment

  6. def aggregatorContext[T](firstOperator: PipelineOperator, otherOperators: List[PipelineOperator], explain: Boolean, allowDiskUse: Boolean, bypassDocumentValidation: Boolean, readConcern: Option[ReadConcern], readPreference: ReadPreference, batchSize: Option[Int])(implicit reader: Reader[T]): AggregatorContext[T]

    Permalink
    Definition Classes
    GenericCollection
    Annotations
    @deprecated @inline()
    Deprecated

    (Since version 0.17.0) Use aggregator context with optional writeConcern

  7. def as[C <: Collection](failoverStrategy: FailoverStrategy = failoverStrategy)(implicit producer: CollectionProducer[C] = BSONCollectionProducer): C

    Permalink

    Gets another implementation of this collection.

    Gets another implementation of this collection. An implicit CollectionProducer[C] must be present in the scope, or it will be the default implementation (reactivemongo.api.collections.bson.BSONCollection).

    failoverStrategy

    the failover strategy to override the default one

    Definition Classes
    Collection
    Annotations
    @deprecated
    Deprecated

    (Since version 0.13.0) Resolve the collection from DB

  8. def canEqual(that: Any): Boolean

    Permalink
    Definition Classes
    BSONCollection → Equals
    Annotations
    @deprecated
    Deprecated

    (Since version 0.12-RC2) No longer a ReactiveMongo case class

  9. def copy(db: DB = this.db, name: String = this.name, failoverStrategy: FailoverStrategy = this.failoverStrategy): BSONCollection

    Permalink
    Annotations
    @deprecated
    Deprecated

    (Since version 0.12-RC2) No longer a ReactiveMongo case class

  10. def count[H](selector: Option[Document] = None, limit: Int = 0, skip: Int = 0, hint: Option[H] = None)(implicit h: (H) ⇒ commands.bson.BSONCountCommand.Hint, ec: ExecutionContext): Future[Int]

    Permalink

    Counts the matching documents.

    Counts the matching documents.

    H

    The type of hint. An implicit H => Hint conversion has to be in the scope.

    selector

    the document selector (default: None to count all)

    limit

    the maximum number of matching documents to count

    skip

    the number of matching documents to skip before counting

    hint

    the index to use (either the index name or the index document)

    Definition Classes
    GenericCollection
    Annotations
    @deprecated
    Deprecated

    (Since version 0.16.0) Use count with readConcern parameter

    See also

    MongoDB documentation

  11. def distinct[T, M[_] <: Iterable[_]](key: String, selector: Option[Document] = None, readConcern: ReadConcern = self.readConcern)(implicit reader: NarrowValueReader[T], ec: ExecutionContext, cbf: CanBuildFrom[M[_], T, M[T]]): Future[M[T]]

    Permalink
    Definition Classes
    GenericCollectionWithDistinctOps
    Annotations
    @deprecated
    Deprecated

    (Since version 0.16.0) Use distinct with Collation

  12. def drop()(implicit ec: ExecutionContext): Future[Unit]

    Permalink

    Drops this collection.

    Drops this collection.

    The returned future will be completed with an error if this collection does not exist.

    Definition Classes
    CollectionMetaCommands
    Annotations
    @deprecated
    Deprecated

    (Since version 0.12.0) Use drop(Boolean)

  13. def find[S, J](selector: S, projection: J)(implicit swriter: Writer[S], pwriter: Writer[J]): GenericQueryBuilder[pack.type]

    Permalink

    Finds the documents matching the given criteria (selector), with the projection applied.

    Finds the documents matching the given criteria (selector), with the projection applied.

    S

    The type of the selector. An implicit Writer[S] typeclass for handling it has to be in the scope.

    selector

    the document selector

    projection

    the projection document to select only a subset of each matching documents

    swriter

    the writer for the selector

    pwriter

    the writer for the projection

    returns

    A GenericQueryBuilder that you can use to to customize the query. You can obtain a cursor by calling the method reactivemongo.api.Cursor on this query builder.

    Definition Classes
    GenericCollection
    Annotations
    @deprecated
    Deprecated

    (Since version 0.16.0) Use find with optional projection

    See also

    MongoDB documentation

  14. def find[S](selector: S)(implicit swriter: Writer[S]): GenericQueryBuilder[pack.type]

    Permalink

    Finds the documents matching the given criteria (selector).

    Finds the documents matching the given criteria (selector).

    S

    The type of the selector. An implicit Writer[S] typeclass for handling it has to be in the scope.

    selector

    the document selector

    swriter

    the writer for the selector

    returns

    A GenericQueryBuilder that you can use to to customize the query. You can obtain a cursor by calling the method reactivemongo.api.Cursor on this query builder.

    Definition Classes
    GenericCollection
    Annotations
    @deprecated
    Deprecated

    (Since version 0.16.0) Use find with optional projection

    See also

    MongoDB documentation

  15. def findAndModify[S](selector: S, modifier: commands.bson.BSONFindAndModifyCommand.Modify, sort: Option[Document] = None, fields: Option[Document] = None)(implicit swriter: Writer[S], ec: ExecutionContext): Future[commands.bson.BSONFindAndModifyCommand.FindAndModifyResult]

    Permalink
    Definition Classes
    GenericCollection
    Annotations
    @deprecated
    Deprecated

    (Since version 0.14.0) Use other findAndModify

  16. def findAndRemove[S](selector: S, sort: Option[Document] = None, fields: Option[Document] = None)(implicit swriter: Writer[S], ec: ExecutionContext): Future[commands.bson.BSONFindAndModifyCommand.FindAndModifyResult]

    Permalink
    Definition Classes
    GenericCollection
    Annotations
    @deprecated
    Deprecated

    (Since version 0.18.0) Use the other findAndRemove

  17. def findAndUpdate[S, T](selector: S, update: T, fetchNewObject: Boolean = false, upsert: Boolean = false, sort: Option[Document] = None, fields: Option[Document] = None)(implicit swriter: Writer[S], writer: Writer[T], ec: ExecutionContext): Future[commands.bson.BSONFindAndModifyCommand.FindAndModifyResult]

    Permalink
    Definition Classes
    GenericCollection
    Annotations
    @deprecated
    Deprecated

    (Since version 0.18.0) Use other findAndUpdate

  18. final def fullCollectionName: String

    Permalink

    Gets the full qualified name of this collection.

    Gets the full qualified name of this collection.

    Definition Classes
    Collection
    Annotations
    @deprecated @inline()
    Deprecated

    (Since version 0.17.0) Internal: will be made private

  19. def insert[T](document: T, writeConcern: commands.WriteConcern = writeConcern)(implicit writer: Writer[T], ec: ExecutionContext): Future[WriteResult]

    Permalink

    Inserts a document into the collection and waits for the reactivemongo.api.commands.WriteResult.

    Inserts a document into the collection and waits for the reactivemongo.api.commands.WriteResult.

    T

    The type of the document to insert. An implicit Writer[T] typeclass for handling it has to be in the scope.

    document

    the document to insert

    writeConcern

    the writer concern to be used

    writer

    the writer to create the document to be inserted

    returns

    a future reactivemongo.api.commands.WriteResult that can be used to check whether the insertion was successful

    import scala.concurrent.ExecutionContext
    import reactivemongo.api.bson.BSONDocument
    import reactivemongo.api.bson.collection.BSONCollection
    def withDefaultWriteConcern(coll: BSONCollection, myDoc: BSONDocument)(
      implicit ec: ExecutionContext) = coll.insert(myDoc)
    Definition Classes
    GenericCollection
    Annotations
    @deprecated
    Deprecated

    (Since version 0.16.1) Use .insert(ordered = false).one(..)

  20. val productArity: Int

    Permalink
    Definition Classes
    BSONCollection → Product
    Annotations
    @deprecated
    Deprecated

    (Since version 0.12-RC2) No longer a ReactiveMongo case class

  21. def productElement(n: Int): Any

    Permalink
    Definition Classes
    BSONCollection → Product
    Annotations
    @deprecated
    Deprecated

    (Since version 0.12-RC2) No longer a ReactiveMongo case class

  22. def remove[S](selector: S, writeConcern: commands.WriteConcern = writeConcern, firstMatchOnly: Boolean = false)(implicit swriter: Writer[S], ec: ExecutionContext): Future[WriteResult]

    Permalink

    S

    The type of the selector. An implicit Writer[S] typeclass for handling it has to be in the scope.

    writeConcern

    the writer concern to be used

    swriter

    the writer for the selector

    returns

    a future reactivemongo.api.commands.WriteResult that can be used to check whether the removal was successful

    Definition Classes
    GenericCollection
    Annotations
    @deprecated
    Deprecated

    (Since version 0.13.1) Use delete().one(selector, limit)

  23. lazy val removeModifier: commands.bson.BSONFindAndModifyCommand.Remove.type

    Permalink

    Returns a removal modifier, to be used with findAndModify.

    Returns a removal modifier, to be used with findAndModify.

    Definition Classes
    GenericCollection
    Annotations
    @deprecated
    Deprecated

    (Since version 0.16.0) Internal: will be made private

  24. def rename(to: String, dropExisting: Boolean = false)(implicit ec: ExecutionContext): Future[Unit]

    Permalink

    Renames this collection.

    Renames this collection.

    to

    the new name of this collection

    dropExisting

    if a collection of name to already exists, then drops that collection before renaming this one

    returns

    A failure if the dropExisting option is false and the target collection already exists.

    Definition Classes
    CollectionMetaCommands
    Annotations
    @deprecated
    Deprecated

    (Since version 0.12.4) Use reactivemongo.api.DBMetaCommands.renameCollection on the admin database instead.

  25. def sibling[C <: Collection](name: String, failoverStrategy: FailoverStrategy = failoverStrategy)(implicit producer: CollectionProducer[C] = BSONCollectionProducer): C

    Permalink

    Gets another collection in the current database.

    Gets another collection in the current database. An implicit CollectionProducer[C] must be present in the scope, or it will be the default implementation (reactivemongo.api.collections.bson.BSONCollection).

    name

    the name of another collection

    failoverStrategy

    the failover strategy to override the default one

    Definition Classes
    Collection
    Annotations
    @deprecated
    Deprecated

    (Since version 0.19.4) Use DB.collection(name)

  26. def update[S, T](selector: S, update: T, writeConcern: commands.WriteConcern = writeConcern, upsert: Boolean = false, multi: Boolean = false)(implicit swriter: Writer[S], writer: Writer[T], ec: ExecutionContext): Future[UpdateWriteResult]

    Permalink

    Updates one or more documents matching the given selector with the given modifier or update object.

    Updates one or more documents matching the given selector with the given modifier or update object.

    S

    The type of the selector. An implicit Writer[S] typeclass for handling it has to be in the scope.

    T

    The type of the modifier or update object. An implicit Writer[T] typeclass for handling it has to be in the scope.

    selector

    the selector object, for finding the documents to update.

    update

    the modifier object (with special keys like $set) or replacement object.

    writeConcern

    the writer concern to be used

    upsert

    if true, creates a new document if no document is matching, otherwise if at least one document matches, an update is applied (defaults: false)

    multi

    states whether the update may be done on all the matching documents (default: false)

    swriter

    the writer for the selector

    writer

    the writer to create the document

    returns

    a future reactivemongo.api.commands.WriteResult that can be used to check whether the insertion was successful

    Definition Classes
    GenericCollection
    Annotations
    @deprecated
    Deprecated

    (Since version 0.16.1) Use .update(ordered = false).one(..)

Inherited from Serializable

Inherited from Serializable

Inherited from HintFactory[BSONSerializationPack.type]

Inherited from GenericCollectionWithQueryBuilder[BSONSerializationPack.type]

Inherited from GenericCollectionMetaCommands[BSONSerializationPack.type]

Inherited from collections.Aggregator[BSONSerializationPack.type]

Inherited from ChangeStreamOps[BSONSerializationPack.type]

Inherited from GenericCollectionWithDistinctOps[BSONSerializationPack.type]

Inherited from DistinctOp[BSONSerializationPack.type]

Inherited from DistinctOpCompat[BSONSerializationPack.type]

Inherited from CountOp[BSONSerializationPack.type]

Inherited from DeleteOps[BSONSerializationPack.type]

Inherited from UpdateOps[BSONSerializationPack.type]

Inherited from InsertOps[BSONSerializationPack.type]

Inherited from CollectionMetaCommands

Inherited from Collection

Inherited from Product

Inherited from Equals

Inherited from AnyRef

Inherited from Any

Inherited by implicit conversion any2stringadd from BSONCollection to any2stringadd[BSONCollection]

Inherited by implicit conversion StringFormat from BSONCollection to StringFormat[BSONCollection]

Inherited by implicit conversion Ensuring from BSONCollection to Ensuring[BSONCollection]

Inherited by implicit conversion ArrowAssoc from BSONCollection to ArrowAssoc[BSONCollection]

Ungrouped