reactivemongo.api.collections

GenericCollection

trait GenericCollection[Structure, Reader[_], Writer[_]] extends Collection with GenericHandlers[Structure, Reader, Writer]

A Collection that provides default methods using a Structure (like reactivemongo.bson.BSONDocument, or a Json document, etc.).

Some methods of this collection accept instances of Reader[T] and Writer[T], that transform any T instance into a Structure and vice-versa. The default implementation of Collection, reactivemongo.api.collections.default.BSONCollection, extends this trait.

Structure

The structure that will be turned into BSON (and vice versa), usually a reactivemongo.bson.BSONDocument or a Json document.

Reader

A Reader[T] that produces a T instance from a Structure.

Writer

A Writer[T] that produces a Structure instance from a T.

Linear Supertypes
GenericHandlers[Structure, Reader, Writer], Collection, AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. GenericCollection
  2. GenericHandlers
  3. Collection
  4. AnyRef
  5. Any
Implicitly
  1. by any2stringadd
  2. by StringFormat
  3. by Ensuring
  4. by ArrowAssoc
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Type Members

  1. case class GenericBufferReader[T](reader: Reader[T]) extends BufferReader[T] with Product with Serializable

    Definition Classes
    GenericHandlers
  2. case class GenericBufferWriter[T](writer: Writer[T]) extends BufferWriter[T] with Product with Serializable

    Definition Classes
    GenericHandlers

Abstract Value Members

  1. abstract def StructureBufferReader: BufferReader[Structure]

    Definition Classes
    GenericHandlers
  2. abstract def StructureBufferWriter: BufferWriter[Structure]

    Definition Classes
    GenericHandlers
  3. abstract def StructureReader[T](reader: Reader[T]): GenericReader[Structure, T]

    Definition Classes
    GenericHandlers
  4. abstract def StructureWriter[T](writer: Writer[T]): GenericWriter[T, Structure]

    Definition Classes
    GenericHandlers
  5. abstract def db: DB

    The database which this collection belong to.

    The database which this collection belong to.

    Definition Classes
    Collection
  6. abstract def failoverStrategy: FailoverStrategy

    The default failover strategy for the methods of this collection.

    The default failover strategy for the methods of this collection.

    Definition Classes
    GenericCollectionCollection
  7. abstract def genericQueryBuilder: GenericQueryBuilder[Structure, Reader, Writer]

  8. abstract def name: String

    The name of the collection.

    The name of the collection.

    Definition Classes
    Collection

Concrete Value Members

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

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

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

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

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

    Definition Classes
    AnyRef → Any
  6. def BufferReaderInstance[T](reader: Reader[T]): GenericBufferReader[T]

    Definition Classes
    GenericHandlers
  7. def BufferWriterInstance[T](writer: Writer[T]): GenericBufferWriter[T]

    Definition Classes
    GenericHandlers
  8. def as[C <: Collection](failoverStrategy: FailoverStrategy = failoverStrategy)(implicit producer: CollectionProducer[C] = ...): C

    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.default.BSONCollection).

    failoverStrategy

    Overrides the default strategy.

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

    Definition Classes
    Any
  10. def bulkInsert[T](enumerator: Enumerator[T], writeConcern: GetLastError = GetLastError(), bulkSize: Int = bulk.MaxDocs, bulkByteSize: Int = bulk.MaxBulkSize)(implicit writer: Writer[T], ec: ExecutionContext): Future[Int]

  11. def bulkInsertIteratee[T](writeConcern: GetLastError = GetLastError(), bulkSize: Int = bulk.MaxDocs, bulkByteSize: Int = bulk.MaxBulkSize)(implicit writer: Writer[T], ec: ExecutionContext): Iteratee[T, Int]

  12. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  13. def ensuring(cond: (GenericCollection[Structure, Reader, Writer]) ⇒ Boolean, msg: ⇒ Any): GenericCollection[Structure, Reader, Writer]

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

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

    Implicit information
    This member is added by an implicit conversion from GenericCollection[Structure, Reader, Writer] to Ensuring[GenericCollection[Structure, Reader, Writer]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  16. def ensuring(cond: Boolean): GenericCollection[Structure, Reader, Writer]

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

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

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

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

    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.

    P

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

    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.

  21. def find[S](selector: S)(implicit swriter: Writer[S]): GenericQueryBuilder[Structure, Reader, Writer]

    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.

  22. def formatted(fmtstr: String): String

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

    Gets the full qualified name of this collection.

    Gets the full qualified name of this collection.

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

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

    Definition Classes
    AnyRef → Any
  26. def insert(document: Structure)(implicit ec: ExecutionContext): Future[LastError]

    Inserts a document into the collection and wait for the reactivemongo.core.commands.LastError result.

    Inserts a document into the collection and wait for the reactivemongo.core.commands.LastError result.

    document

    the document to insert.

    returns

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

  27. def insert(document: Structure, writeConcern: GetLastError)(implicit ec: ExecutionContext): Future[LastError]

    Inserts a document into the collection and wait for the reactivemongo.core.commands.LastError result.

    Inserts a document into the collection and wait for the reactivemongo.core.commands.LastError result.

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

    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.core.commands.LastError that can be used to check whether the insertion was successful.

  28. def insert[T](document: T, writeConcern: GetLastError = GetLastError())(implicit writer: Writer[T], ec: ExecutionContext): Future[LastError]

    Inserts a document into the collection and wait for the reactivemongo.core.commands.LastError result.

    Inserts a document into the collection and wait for the reactivemongo.core.commands.LastError result.

    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.core.commands.LastError that can be used to check whether the insertion was successful.

  29. final def isInstanceOf[T0]: Boolean

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

    Definition Classes
    AnyRef
  31. final def notify(): Unit

    Definition Classes
    AnyRef
  32. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  33. def remove[T](query: T, writeConcern: GetLastError = GetLastError(), firstMatchOnly: Boolean = false)(implicit writer: Writer[T], ec: ExecutionContext): Future[LastError]

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

    Remove the matched document(s) from the collection and wait for the reactivemongo.core.commands.LastError 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.core.commands.LastError that can be used to check whether the removal was successful.

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

    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.default.BSONCollection).

    name

    The other collection name.

    failoverStrategy

    Overrides the default strategy.

    Definition Classes
    Collection
  35. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  36. def toString(): String

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

    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.

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

    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.

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

    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.

  40. def update[S, U](selector: S, update: U, writeConcern: GetLastError = GetLastError(), upsert: Boolean = false, multi: Boolean = false)(implicit selectorWriter: Writer[S], updateWriter: Writer[U], ec: ExecutionContext): Future[LastError]

    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.core.commands.LastError that can be used to check whether the update was successful.

  41. final def wait(): Unit

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

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

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

    Attributes
    protected
  45. def [B](y: B): (GenericCollection[Structure, Reader, Writer], B)

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

Deprecated Value Members

  1. def sister[C <: Collection](name: String, failoverStrategy: FailoverStrategy = failoverStrategy)(implicit producer: CollectionProducer[C] = ...): C

    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.default.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 GenericHandlers[Structure, Reader, Writer]

Inherited from Collection

Inherited from AnyRef

Inherited from Any

Inherited by implicit conversion any2stringadd from GenericCollection[Structure, Reader, Writer] to any2stringadd[GenericCollection[Structure, Reader, Writer]]

Inherited by implicit conversion StringFormat from GenericCollection[Structure, Reader, Writer] to StringFormat[GenericCollection[Structure, Reader, Writer]]

Inherited by implicit conversion Ensuring from GenericCollection[Structure, Reader, Writer] to Ensuring[GenericCollection[Structure, Reader, Writer]]

Inherited by implicit conversion ArrowAssoc from GenericCollection[Structure, Reader, Writer] to ArrowAssoc[GenericCollection[Structure, Reader, Writer]]

Ungrouped