Trait

reactivemongo.api.collections

GenericCollection

Related Doc: package collections

Permalink

trait GenericCollection[P <: SerializationPack with Singleton] extends Collection with GenericCollectionWithCommands[P] with CollectionMetaCommands with ImplicitCommandHelpers[P]

A Collection that provides default methods using a SerializationPack (e.g. the default reactivemongo.api.BSONSerializationPack).

Some methods of this collection accept instances of Reader[T] and Writer[T], that transform any T instance into a document, compatible with the selected serialization pack, and vice-versa.

P

the serialization pack

Self Type
GenericCollection[P]
Linear Supertypes
Known Subclasses
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. GenericCollection
  2. ImplicitCommandHelpers
  3. CollectionMetaCommands
  4. GenericCollectionWithCommands
  5. Collection
  6. AnyRef
  7. 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

Type Members

  1. sealed trait BulkMaker[R, S <: BulkMaker[R, S]] extends AnyRef

    Permalink
    Attributes
    protected
  2. trait ImplicitlyDocumentProducer extends AnyRef

    Permalink
    Definition Classes
    ImplicitCommandHelpers
  3. class Mongo26WriteCommand extends BulkMaker[WriteResult, Mongo26WriteCommand]

    Permalink
    Attributes
    protected
  4. type PipelineOperator = commands.AggregationFramework.PipelineOperator

    Permalink

    Alias for BatchCommands.AggregationFramework.PipelineOperator

Abstract Value Members

  1. abstract val BatchCommands: BatchCommands[pack.type]

    Permalink
    Attributes
    protected
  2. abstract def db: DB

    Permalink

    The database which this collection belong to.

    The database which this collection belong to.

    Definition Classes
    Collection
  3. abstract def 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
    GenericCollectionCollection
  4. abstract def genericQueryBuilder: GenericQueryBuilder[pack.type]

    Permalink
  5. abstract def name: String

    Permalink

    The name of the collection.

    The name of the collection.

    Definition Classes
    Collection
  6. abstract val pack: P

    Permalink

Concrete 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 GenericCollection[P] to any2stringadd[GenericCollection[P]] performed by method any2stringadd in scala.Predef.
    Definition Classes
    any2stringadd
  4. def ->[B](y: B): (GenericCollection[P], B)

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

    Permalink
    Definition Classes
    AnyRef → Any
  6. object ImplicitlyDocumentProducer

    Permalink
    Definition Classes
    ImplicitCommandHelpers
  7. object Mongo26WriteCommand

    Permalink
    Attributes
    protected
  8. implicit def PackIdentityReader: P.Reader[P.Document]

    Permalink
  9. implicit def PackIdentityWriter: P.Writer[P.Document]

    Permalink
  10. def aggregate(firstOperator: PipelineOperator, otherOperators: List[PipelineOperator] = Nil, explain: Boolean = false, allowDiskUse: Boolean = false, bypassDocumentValidation: Boolean = false, readConcern: Option[ReadConcern] = None)(implicit ec: ExecutionContext): Future[AggregationResult]

    Permalink

    Aggregates the matching documents.

    Aggregates the matching documents.

    import scala.concurrent.Future
    import scala.concurrent.ExecutionContext.Implicits.global
    
    import reactivemongo.bson._
    import reactivemongo.api.collections.bson.BSONCollection
    
    def populatedStates(cities: BSONCollection): Future[List[BSONDocument]] = {
      import cities.BatchCommands.AggregationFramework
      import AggregationFramework.{ Group, Match, SumField }
    
      cities.aggregate(Group(BSONString("$state"))(
        "totalPop" -> SumField("population")), List(
          Match(document("totalPop" ->
            document("$gte" -> 10000000L))))).map(_.documents)
    }
    firstOperator

    the first operator of the pipeline

    otherOperators

    the sequence of MongoDB aggregation operations

    explain

    specifies to return the information on the processing of the pipeline

    allowDiskUse

    enables writing to temporary files

    bypassDocumentValidation

    enables to bypass document validation during the operation

    readConcern

    the read concern

  11. def aggregate1[T](firstOperator: PipelineOperator, otherOperators: List[PipelineOperator], cursor: commands.AggregationFramework.Cursor, explain: Boolean = false, allowDiskUse: Boolean = false, bypassDocumentValidation: Boolean = false, readConcern: Option[ReadConcern] = None, readPreference: ReadPreference = ReadPreference.primary)(implicit ec: ExecutionContext, r: P.Reader[T]): Future[Cursor[T]]

    Permalink

    Aggregates the matching documents.

    Aggregates the matching documents.

    import scala.concurrent.Future
    import scala.concurrent.ExecutionContext.Implicits.global
    
    import reactivemongo.bson._
    import reactivemongo.api.Cursor
    import reactivemongo.api.collections.bson.BSONCollection
    
    def populatedStates(cities: BSONCollection): Future[Cursor[BSONDocument]] =
      {
        import cities.BatchCommands.AggregationFramework
        import AggregationFramework.{
          Cursor => AggCursor, Group, Match, SumField
        }
    
        val cursor = AggCursor(batchSize = 1) // initial batch size
    
        cities.aggregate1[BSONDocument](Group(BSONString("$state"))(
          "totalPop" -> SumField("population")), List(
            Match(document("totalPop" ->
              document("$gte" -> 10000000L)))),
          cursor)
      }
    T

    the result type

    firstOperator

    the first operator of the pipeline

    otherOperators

    the sequence of MongoDB aggregation operations

    cursor

    the cursor object for aggregation

    explain

    specifies to return the information on the processing of the pipeline

    allowDiskUse

    enables writing to temporary files

    bypassDocumentValidation

    enables to bypass document validation during the operation

    readConcern

    the read concern of the aggregation

    readPreference

    the read preference for the result cursor

  12. def as[C <: Collection](failoverStrategy: FailoverStrategy = failoverStrategy)(implicit producer: CollectionProducer[C] = ...): 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

    Overrides the default strategy.

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

    Permalink
    Definition Classes
    Any
  14. def bulkInsert(documents: Stream[P.Document], ordered: Boolean, writeConcern: WriteConcern = defaultWriteConcern, bulkSize: Int, bulkByteSize: Int)(implicit ec: ExecutionContext): Future[MultiBulkWriteResult]

    Permalink
  15. def bulkInsert(documents: Stream[P.Document], ordered: Boolean, writeConcern: WriteConcern)(implicit ec: ExecutionContext): Future[MultiBulkWriteResult]

    Permalink
  16. def bulkInsert(documents: Stream[P.Document], ordered: Boolean)(implicit ec: ExecutionContext): Future[MultiBulkWriteResult]

    Permalink
  17. def bulkInsert(ordered: Boolean, writeConcern: WriteConcern, bulkSize: Int, bulkByteSize: Int)(documents: ImplicitlyDocumentProducer*)(implicit ec: ExecutionContext): Future[MultiBulkWriteResult]

    Permalink
  18. def bulkInsert(ordered: Boolean, writeConcern: WriteConcern)(documents: ImplicitlyDocumentProducer*)(implicit ec: ExecutionContext): Future[MultiBulkWriteResult]

    Permalink
  19. def bulkInsert(ordered: Boolean)(documents: ImplicitlyDocumentProducer*)(implicit ec: ExecutionContext): Future[MultiBulkWriteResult]

    Permalink
  20. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  21. 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.

    size

    The size of this capped collection, in bytes.

    maxDocuments

    The maximum number of documents this capped collection can contain.

    Definition Classes
    CollectionMetaCommands
  22. def count[H](selector: Option[P.Document] = None, limit: Int = 0, skip: Int = 0, hint: Option[H] = None)(implicit h: (H) ⇒ Hint, ec: ExecutionContext): Future[Int]

    Permalink

    Count the documents matching the given criteria.

    Count the documents matching the given criteria.

    This method accepts any query or hint, the scope provides instances of appropriate typeclasses.

    Please take a look to the mongodb documentation to know how querying works.

    H

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

    selector

    the query 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)

  23. def create(autoIndexId: Boolean = true)(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.

    autoIndexId

    States if should automatically add an index on the _id field. By default, regular collections will have an indexed _id field, in contrast to capped collections.

    Definition Classes
    CollectionMetaCommands
  24. 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.

    size

    the byte size of the collections.

    maxDocuments

    the maximum number of documents.

    autoIndexId

    States if should automatically add an index on the _id field. By default, capped collections will NOT have an indexed _id field, in contrast to regular collections.

    Definition Classes
    CollectionMetaCommands
  25. def distinct[T, M[_] <: Iterable[_]](key: String, selector: Option[P.Document] = None, readConcern: ReadConcern = ReadConcern.Local)(implicit reader: P.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 Iterable

    key

    the field for which to return distinct values

    selector

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

    readConcern

    the read concern

    val distinctStates = collection.distinct[String, Set]("state")
  26. 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.

    Definition Classes
    CollectionMetaCommands
  27. def ensuring(cond: (GenericCollection[P]) ⇒ Boolean, msg: ⇒ Any): GenericCollection[P]

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

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

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

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

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

    Permalink
    Definition Classes
    AnyRef → Any
  33. def finalize(): Unit

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

    Permalink

    Find the documents matching the given criteria.

    Find the documents matching the given criteria.

    This method accepts any selector and projection object, provided that there is an implicit Writer[S] typeclass for handling them in the scope.

    Please take a look to the mongodb documentation to know how querying works.

    S

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

    P

    the type of the projection object. An implicit Writer[P] typeclass for handling it has to be in the scope.

    selector

    the query selector.

    projection

    Get only a subset of each matched documents. Defaults to None.

    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.

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

    Permalink

    Find the documents matching the given criteria.

    Find the documents matching the given criteria.

    This method accepts any query and projection object, provided that there is an implicit Writer[S] typeclass for handling them in the scope.

    Please take a look to the mongodb documentation to know how querying works.

    S

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

    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.

  36. def findAndModify[Q](selector: Q, modifier: Modify, sort: Option[P.Document] = None, fields: Option[P.Document] = None)(implicit selectorWriter: P.Writer[Q], ec: ExecutionContext): Future[FindAndModifyResult]

    Permalink

    Applies a findAndModify operation.

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

    val updateOp = collection.updateModifier(
      BSONDocument("$set" -> BSONDocument("age" -> 35)))
    
    val personBeforeUpdate: Future[Person] =
      collection.findAndModify(BSONDocument("name" -> "Joline"), updateOp).
      map(_.result[Person])
    
    val removedPerson: Future[Person] = collection.findAndModify(
      BSONDocument("name" -> "Jack"), collection.removeModifier)
    selector

    the query selector

    modifier

    the modify operator to be applied

    sort

    the optional document possibly indicating the sort criterias

    fields

    the field projection

  37. def findAndRemove[Q](selector: Q, sort: Option[P.Document] = None, fields: Option[P.Document] = None)(implicit selectorWriter: P.Writer[Q], ec: ExecutionContext): Future[FindAndModifyResult]

    Permalink

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

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

    val removed: Future[Person] = collection.findAndRemove(
      BSONDocument("name" -> "Foo")).map(_.result[Person])
    selector

    the query selector

    sort

    the optional document possibly indicating the sort criterias

    fields

    the field projection

  38. def findAndUpdate[Q, U](selector: Q, update: U, fetchNewObject: Boolean = false, upsert: Boolean = false, sort: Option[P.Document] = None, fields: Option[P.Document] = None)(implicit selectorWriter: P.Writer[Q], updateWriter: P.Writer[U], ec: ExecutionContext): Future[FindAndModifyResult]

    Permalink

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

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

    val person: Future[BSONDocument] = collection.findAndUpdate(
      BSONDocument("name" -> "James"),
      BSONDocument("$set" -> BSONDocument("age" -> 17)),
      fetchNewObject = true) // on success, return the update document:
                             // { "age": 17 }
    selector

    the query 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 matches the query, or if documents match the query, findAndModify performs an update

    sort

    the optional document possibly indicating the sort criterias

    fields

    the field projection

  39. def formatted(fmtstr: String): String

    Permalink
    Implicit information
    This member is added by an implicit conversion from GenericCollection[P] to StringFormat[GenericCollection[P]] performed by method StringFormat in scala.Predef.
    Definition Classes
    StringFormat
    Annotations
    @inline()
  40. def fullCollectionName: String

    Permalink

    Gets the full qualified name of this collection.

    Gets the full qualified name of this collection.

    Definition Classes
    Collection
  41. final def getClass(): Class[_]

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

    Permalink
    Definition Classes
    AnyRef → Any
  43. def indexesManager(implicit ec: ExecutionContext): CollectionIndexesManager

    Permalink

    Returns an index manager for this collection.

    Returns an index manager for this collection.

    Definition Classes
    CollectionMetaCommands
  44. def insert[T](document: T, writeConcern: WriteConcern = defaultWriteConcern)(implicit writer: P.Writer[T], ec: ExecutionContext): Future[WriteResult]

    Permalink

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

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

    Please read the documentation about reactivemongo.core.commands.GetLastError to know how to use it properly.

    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 reactivemongo.core.commands.GetLastError command message to send in order to control how the document is inserted. Defaults to GetLastError().

    returns

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

  45. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  46. final def ne(arg0: AnyRef): Boolean

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

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

    Permalink
    Definition Classes
    AnyRef
  49. def remove[T](query: T, writeConcern: WriteConcern = defaultWriteConcern, firstMatchOnly: Boolean = false)(implicit writer: P.Writer[T], ec: ExecutionContext): Future[WriteResult]

    Permalink

    Remove the matched document(s) from the collection and wait for the reactivemongo.api.commands.WriteResult result.

    Remove the matched document(s) from the collection and wait for the reactivemongo.api.commands.WriteResult result.

    Please read the documentation about reactivemongo.core.commands.GetLastError to know how to use it properly.

    T

    the type of the selector of documents to remove. An implicit Writer[T] typeclass for handling it has to be in the scope.

    query

    the selector of documents to remove.

    writeConcern

    the reactivemongo.core.commands.GetLastError command message to send in order to control how the documents are removed. Defaults to GetLastError().

    firstMatchOnly

    states whether only the first matched documents has to be removed from this collection.

    returns

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

  50. lazy val removeModifier: Remove.type

    Permalink

    Returns a removal modifier, to be used with findAndModify.

  51. 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.

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

    Permalink
  53. def runCommand[R, C <: CollectionCommand with CommandWithResult[R]](command: C with CommandWithResult[R])(implicit writer: P.Writer[ResolvedCollectionCommand[C]], reader: P.Reader[R], ec: ExecutionContext): Future[R]

    Permalink
  54. def runValueCommand[A <: AnyVal, R <: BoxedAnyVal[A], C <: CollectionCommand with CommandWithResult[R]](command: C with CommandWithResult[R with BoxedAnyVal[A]])(implicit writer: P.Writer[ResolvedCollectionCommand[C]], reader: P.Reader[R], ec: ExecutionContext): Future[A]

    Permalink
  55. def runWithResponse[R, C <: CollectionCommand with CommandWithResult[R]](command: C with CommandWithResult[R])(implicit writer: P.Writer[ResolvedCollectionCommand[C]], reader: P.Reader[R], ec: ExecutionContext): Future[ResponseResult[R]]

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

    Permalink
  57. def sibling[C <: Collection](name: String, failoverStrategy: FailoverStrategy = failoverStrategy)(implicit producer: CollectionProducer[C] = ...): 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 other collection name.

    failoverStrategy

    Overrides the default strategy.

    Definition Classes
    Collection
  58. def stats(scale: Int)(implicit ec: ExecutionContext): Future[CollStatsResult]

    Permalink

    Returns various information about this collection.

    Returns various information about this collection.

    scale

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

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

    Permalink

    Returns various information about this collection.

    Returns various information about this collection.

    Definition Classes
    CollectionMetaCommands
  60. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  61. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  62. def uncheckedInsert[T](document: T)(implicit writer: P.Writer[T]): Unit

    Permalink

    Inserts a document into the collection without writeConcern.

    Inserts a document into the collection without writeConcern.

    Please note that you cannot be sure that the document has been effectively written and when (hence the Unit return type).

    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.

  63. def uncheckedRemove[T](query: T, firstMatchOnly: Boolean = false)(implicit writer: P.Writer[T], ec: ExecutionContext): Unit

    Permalink

    Remove the matched document(s) from the collection without writeConcern.

    Remove the matched document(s) from the collection without writeConcern.

    Please note that you cannot be sure that the matched documents have been effectively removed and when (hence the Unit return type).

    T

    the type of the selector of documents to remove. An implicit Writer[T] typeclass for handling it has to be in the scope.

    query

    the selector of documents to remove.

    firstMatchOnly

    states whether only the first matched documents has to be removed from this collection.

  64. def uncheckedUpdate[S, U](selector: S, update: U, upsert: Boolean = false, multi: Boolean = false)(implicit selectorWriter: P.Writer[S], updateWriter: P.Writer[U]): Unit

    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.

    Please note that you cannot be sure that the matched documents have been effectively updated and when (hence the Unit return type).

    S

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

    U

    the type of the modifier or update object. An implicit Writer[U] 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.

    upsert

    states whether the update objet should be inserted if no match found. Defaults to false.

    multi

    states whether the update may be done on all the matching documents.

  65. def update[S, U](selector: S, update: U, writeConcern: WriteConcern = defaultWriteConcern, upsert: Boolean = false, multi: Boolean = false)(implicit selectorWriter: P.Writer[S], updateWriter: P.Writer[U], 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 object. An implicit Writer[S] typeclass for handling it has to be in the scope.

    U

    the type of the modifier or update object. An implicit Writer[U] 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 reactivemongo.core.commands.GetLastError command message to send in order to control how the documents are updated. Defaults to GetLastError().

    upsert

    states whether the update objet should be inserted if no match found. Defaults to false.

    multi

    states whether the update may be done on all the matching documents.

    returns

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

  66. def updateModifier[U](update: U, fetchNewObject: Boolean = false, upsert: Boolean = false)(implicit updateWriter: P.Writer[U]): 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 matches the query, or if documents match the query, findAndModify performs an update

  67. final def wait(): Unit

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

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

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  70. def watchFailure[T](future: ⇒ Future[T]): Future[T]

    Permalink
    Attributes
    protected
  71. def [B](y: B): (GenericCollection[P], B)

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

Deprecated Value Members

  1. 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)

  2. def emptyCapped()(implicit ec: ExecutionContext): Future[Unit]

    Permalink

    If this collection is capped, removes all the documents it contains.

    If this collection is capped, removes all the documents it contains.

    Deprecated because it became an internal command, unavailable by default.

    Definition Classes
    CollectionMetaCommands
    Annotations
    @deprecated
    Deprecated

    (Since version 0.9) Deprecated because emptyCapped became an internal command, unavailable by default.

  3. def sister[C <: Collection](name: String, failoverStrategy: FailoverStrategy = failoverStrategy)(implicit producer: CollectionProducer[C] = ...): 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 other collection name.

    failoverStrategy

    Overrides the default strategy.

    Definition Classes
    Collection
    Annotations
    @deprecated
    Deprecated

    (Since version 0.10) Consider using sibling instead

Inherited from ImplicitCommandHelpers[P]

Inherited from CollectionMetaCommands

Inherited from GenericCollectionWithCommands[P]

Inherited from Collection

Inherited from AnyRef

Inherited from Any

Inherited by implicit conversion any2stringadd from GenericCollection[P] to any2stringadd[GenericCollection[P]]

Inherited by implicit conversion StringFormat from GenericCollection[P] to StringFormat[GenericCollection[P]]

Inherited by implicit conversion Ensuring from GenericCollection[P] to Ensuring[GenericCollection[P]]

Inherited by implicit conversion ArrowAssoc from GenericCollection[P] to ArrowAssoc[GenericCollection[P]]

Ungrouped