reactivemongo.api.collections.bson

BSONQueryBuilder

case class BSONQueryBuilder(collection: Collection, failoverStrategy: FailoverStrategy, queryOption: Option[BSONDocument] = scala.None, sortOption: Option[BSONDocument] = scala.None, projectionOption: Option[BSONDocument] = scala.None, hintOption: Option[BSONDocument] = scala.None, explainFlag: Boolean = false, snapshotFlag: Boolean = false, commentString: Option[String] = scala.None, options: QueryOpts = ..., maxTimeMsOption: Option[Long] = scala.None) extends GenericQueryBuilder[BSONSerializationPack.type] with Product with Serializable

Annotations
@SerialVersionUID( 1634796413L ) @deprecated
Deprecated

(Since version 0.16.0) Useless, will be remove

Linear Supertypes
Serializable, Serializable, Product, Equals, GenericQueryBuilder[BSONSerializationPack.type], QueryOps, AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. BSONQueryBuilder
  2. Serializable
  3. Serializable
  4. Product
  5. Equals
  6. GenericQueryBuilder
  7. QueryOps
  8. AnyRef
  9. Any
Implicitly
  1. by any2stringadd
  2. by any2stringfmt
  3. by any2ArrowAssoc
  4. by any2Ensuring
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Instance Constructors

  1. new BSONQueryBuilder(collection: Collection, failoverStrategy: FailoverStrategy, queryOption: Option[BSONDocument] = scala.None, sortOption: Option[BSONDocument] = scala.None, projectionOption: Option[BSONDocument] = scala.None, hintOption: Option[BSONDocument] = scala.None, explainFlag: Boolean = false, snapshotFlag: Boolean = false, commentString: Option[String] = scala.None, options: QueryOpts = ..., maxTimeMsOption: Option[Long] = scala.None)

Type Members

  1. type Self = BSONQueryBuilder

    Definition Classes
    BSONQueryBuilderGenericQueryBuilderQueryOps

Value Members

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

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

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

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

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

    Definition Classes
    AnyRef
  7. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  8. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  9. def awaitData: Self

    Toggles AwaitData: Block a little while waiting for more data instead of returning immediately if no data.

    Toggles AwaitData: Block a little while waiting for more data instead of returning immediately if no data. Use along with TailableCursor.

    Definition Classes
    GenericQueryBuilderQueryOps
  10. def batchSize(n: Int): Self

    Sets an upper limit on the number of documents to retrieve per batch.

    Sets an upper limit on the number of documents to retrieve per batch. Defaults to 0 (meaning no upper limit - MongoDB decides).

    Definition Classes
    GenericQueryBuilderQueryOps
  11. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  12. val collection: Collection

    Definition Classes
    BSONQueryBuilderGenericQueryBuilder
  13. def comment(message: String): Self

    Adds a comment to this query, that may appear in the MongoDB logs.

    Adds a comment to this query, that may appear in the MongoDB logs.

    Definition Classes
    GenericQueryBuilder
  14. val commentString: Option[String]

    Definition Classes
    BSONQueryBuilderGenericQueryBuilder
  15. def copy(queryOption: Option[BSONDocument] = queryOption, sortOption: Option[BSONDocument] = sortOption, projectionOption: Option[BSONDocument] = projectionOption, hintOption: Option[BSONDocument] = hintOption, explainFlag: Boolean = explainFlag, snapshotFlag: Boolean = snapshotFlag, commentString: Option[String] = commentString, options: QueryOpts = options, failoverStrategy: FailoverStrategy = failoverStrategy, maxTimeMsOption: Option[Long] = maxTimeMsOption): BSONQueryBuilder

    Definition Classes
    BSONQueryBuilderGenericQueryBuilder
  16. def cursor[T](readPreference: ReadPreference = readPreference, isMongo26WriteOp: Boolean = false)(implicit reader: Reader[T], cp: CursorProducer[T]): ProducedCursor

    Returns a Cursor for the result of this query.

    Returns a Cursor for the result of this query.

    import scala.concurrent.{ ExecutionContext, Future }
    
    import reactivemongo.api.Cursor
    import reactivemongo.api.bson.BSONDocument
    import reactivemongo.api.bson.collection.BSONCollection
    
    def findAllVisible(coll: BSONCollection)(
      implicit ec: ExecutionContext): Future[List[BSONDocument]] =
      coll.find(BSONDocument("visible" -> true)).
        cursor[BSONDocument]().collect[List](
         maxDocs = 10,
         err = Cursor.FailOnError[List[BSONDocument]]())
    T

    the results type

    readPreference

    The reactivemongo.api.ReadPreference for this query. If the ReadPreference implies that this query can be run on a secondary, the slaveOk flag will be set.

    reader

    the reader for the results type

    Definition Classes
    GenericQueryBuilder
  17. def ensuring(cond: (BSONQueryBuilder) ⇒ Boolean, msg: ⇒ Any): BSONQueryBuilder

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

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

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

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

    Definition Classes
    AnyRef
  22. def exhaust: Self

    Toggles Exhaust

    Toggles Exhaust

    Definition Classes
    GenericQueryBuilderQueryOps
  23. def explain(flag: Boolean = true): Self

    Toggles explain mode.

    Toggles explain mode.

    Definition Classes
    GenericQueryBuilder
  24. val explainFlag: Boolean

    Definition Classes
    BSONQueryBuilderGenericQueryBuilder
  25. val failoverStrategy: FailoverStrategy

    Definition Classes
    BSONQueryBuilderGenericQueryBuilder
  26. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  27. def formatted(fmtstr: String): String

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

    Definition Classes
    AnyRef → Any
  29. def hint(document: Document): Self

    Sets the hint document (a document that declares the index MongoDB should use for this query).

    Sets the hint document (a document that declares the index MongoDB should use for this query).

    Definition Classes
    GenericQueryBuilder
  30. val hintOption: Option[BSONDocument]

    Definition Classes
    BSONQueryBuilderGenericQueryBuilder
  31. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  32. def maxTimeMs(p: Long): Self

    Adds maxTimeMs to query

    Adds maxTimeMs to query

    Definition Classes
    GenericQueryBuilder
  33. val maxTimeMsOption: Option[Long]

    Definition Classes
    BSONQueryBuilderGenericQueryBuilder
  34. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  35. def noCursorTimeout: Self

    Toggles NoCursorTimeout: The cursor will not expire automatically

    Toggles NoCursorTimeout: The cursor will not expire automatically

    Definition Classes
    GenericQueryBuilderQueryOps
  36. final def notify(): Unit

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

    Definition Classes
    AnyRef
  38. def one[T](readPreference: ReadPreference)(implicit reader: Reader[T], ec: ExecutionContext): Future[Option[T]]

    Sends this query and gets a future Option[T] (alias for reactivemongo.api.Cursor.headOption).

    Sends this query and gets a future Option[T] (alias for reactivemongo.api.Cursor.headOption).

    import scala.concurrent.{ ExecutionContext, Future }
    
    import reactivemongo.api.ReadPreference
    import reactivemongo.api.bson.BSONDocument
    import reactivemongo.api.bson.collection.BSONCollection
    
    def findUser(coll: BSONCollection, name: String)(
      implicit ec: ExecutionContext): Future[Option[BSONDocument]] =
      coll.find(BSONDocument("user" -> name)).
        one[BSONDocument](ReadPreference.primaryPreferred)
    T

    the results type

    readPreference

    The reactivemongo.api.ReadPreference for this query. If the ReadPreference implies that this query can be run on a secondary, the slaveOk flag will be set.

    reader

    the reader for the results type

    Definition Classes
    GenericQueryBuilder
  39. def one[T](implicit reader: Reader[T], ec: ExecutionContext): Future[Option[T]]

    Sends this query and gets a future Option[T] (alias for reactivemongo.api.Cursor.headOption) (using the default reactivemongo.api.ReadPreference).

    Sends this query and gets a future Option[T] (alias for reactivemongo.api.Cursor.headOption) (using the default reactivemongo.api.ReadPreference).

    import scala.concurrent.{ ExecutionContext, Future }
    
    import reactivemongo.api.bson.{ BSONDocument, Macros }
    import reactivemongo.api.bson.collection.BSONCollection
    
    case class User(name: String, pass: String)
    
    implicit val handler = Macros.reader[User]
    
    def findUser(coll: BSONCollection, name: String)(
      implicit ec: ExecutionContext): Future[Option[User]] =
      coll.find(BSONDocument("user" -> name)).one[User]
    T

    the results type

    reader

    the reader for the results type

    Definition Classes
    GenericQueryBuilder
  40. def oplogReplay: Self

    Toggles OplogReplay

    Toggles OplogReplay

    Definition Classes
    GenericQueryBuilderQueryOps
  41. def options(options: QueryOpts): Self

    Definition Classes
    GenericQueryBuilder
  42. val options: QueryOpts

    Definition Classes
    BSONQueryBuilderGenericQueryBuilder
  43. val pack: BSONSerializationPack.type

    Definition Classes
    BSONQueryBuilderGenericQueryBuilder
  44. def partial: Self

    Toggles Partial: The response can be partial - if a shard is down, no error will be thrown.

    Toggles Partial: The response can be partial - if a shard is down, no error will be thrown.

    Definition Classes
    GenericQueryBuilderQueryOps
  45. def projection(p: Document): Self

    Sets the projection specification to determine which fields to include in the returned documents.

    Sets the projection specification to determine which fields to include in the returned documents.

    Definition Classes
    GenericQueryBuilder
  46. def projection[Pjn](p: Pjn)(implicit writer: Writer[Pjn]): Self

    Sets the projection specification to determine which fields to include in the returned documents.

    Sets the projection specification to determine which fields to include in the returned documents.

    Pjn

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

    Definition Classes
    GenericQueryBuilder
  47. val projectionOption: Option[BSONDocument]

    Definition Classes
    BSONQueryBuilderGenericQueryBuilder
  48. val queryOption: Option[BSONDocument]

    Definition Classes
    BSONQueryBuilderGenericQueryBuilder
  49. def readConcern: ReadConcern

    The read concern (since 3.

    The read concern (since 3.2)

    Definition Classes
    GenericQueryBuilder
  50. def requireOne[T](readPreference: ReadPreference)(implicit reader: Reader[T], ec: ExecutionContext): Future[T]

    Sends this query and gets a future T (alias for reactivemongo.api.Cursor.head).

    Sends this query and gets a future T (alias for reactivemongo.api.Cursor.head).

    import scala.concurrent.{ ExecutionContext, Future }
    
    import reactivemongo.api.ReadPreference
    import reactivemongo.api.bson.{ BSONDocument, Macros }
    import reactivemongo.api.bson.collection.BSONCollection
    
    case class User(name: String, pass: String)
    
    implicit val handler = Macros.handler[User]
    
    def findUser(coll: BSONCollection, name: String)(
      implicit ec: ExecutionContext): Future[User] =
      coll.find(BSONDocument("user" -> name)).
        requireOne[User](ReadPreference.primaryPreferred)
    T

    the results type

    readPreference

    The reactivemongo.api.ReadPreference for this query. If the ReadPreference implies that this query can be run on a secondary, the slaveOk flag will be set.

    reader

    the reader for the results type

    Definition Classes
    GenericQueryBuilder
  51. def requireOne[T](implicit reader: Reader[T], ec: ExecutionContext): Future[T]

    Sends this query and gets a future T (alias for reactivemongo.api.Cursor.head) (using the default reactivemongo.api.ReadPreference).

    Sends this query and gets a future T (alias for reactivemongo.api.Cursor.head) (using the default reactivemongo.api.ReadPreference).

    import scala.concurrent.{ ExecutionContext, Future }
    
    import reactivemongo.api.bson.BSONDocument
    import reactivemongo.api.bson.collection.BSONCollection
    
    def findUser(coll: BSONCollection, name: String)(
      implicit ec: ExecutionContext): Future[BSONDocument] =
      coll.find(BSONDocument("user" -> name)).requireOne[BSONDocument]
    T

    the results type

    reader

    the reader for the results type

    Definition Classes
    GenericQueryBuilder
  52. def skip(n: Int): Self

    Sets the number of documents to skip.

    Sets the number of documents to skip.

    Definition Classes
    GenericQueryBuilderQueryOps
  53. def slaveOk: Self

    Toggles SlaveOk: The query is might be run on a secondary.

    Toggles SlaveOk: The query is might be run on a secondary.

    Definition Classes
    GenericQueryBuilderQueryOps
  54. def snapshot(flag: Boolean = true): Self

    Toggles snapshot mode.

    Toggles snapshot mode.

    Definition Classes
    GenericQueryBuilder
  55. val snapshotFlag: Boolean

    Definition Classes
    BSONQueryBuilderGenericQueryBuilder
  56. def sort(document: Document): Self

    Sets the sort specification for the ordering of the results.

    Sets the sort specification for the ordering of the results.

    import scala.concurrent.{ ExecutionContext, Future }
    
    import reactivemongo.api.Cursor
    import reactivemongo.api.bson.BSONDocument
    import reactivemongo.api.bson.collection.BSONCollection
    
    def findSortedVisible(coll: BSONCollection)(
      implicit ec: ExecutionContext): Future[List[BSONDocument]] =
      coll.find(BSONDocument("visible" -> true)).
        sort(BSONDocument("age" -> 1)). // sort per age
        cursor[BSONDocument]().
        collect[List](
          maxDocs = 100,
          err = Cursor.FailOnError[List[BSONDocument]]())
    Definition Classes
    GenericQueryBuilder
  57. val sortOption: Option[BSONDocument]

    Definition Classes
    BSONQueryBuilderGenericQueryBuilder
  58. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  59. def tailable: Self

    Toggles TailableCursor: Makes the cursor not to close after all the data is consumed.

    Toggles TailableCursor: Makes the cursor not to close after all the data is consumed.

    Definition Classes
    GenericQueryBuilderQueryOps
  60. lazy val version: MongoWireVersion

    Attributes
    protected
    Definition Classes
    GenericQueryBuilder
  61. final def wait(): Unit

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

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

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  64. def [B](y: B): (BSONQueryBuilder, B)

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

Shadowed Implicit Value Members

  1. val self: Any

    Implicit information
    This member is added by an implicit conversion from BSONQueryBuilder to StringAdd performed by method any2stringadd in scala.Predef.
    Shadowing
    This implicitly inherited member is ambiguous. One or more implicitly inherited members have similar signatures, so calling this member may produce an ambiguous implicit conversion compiler error.
    To access this member you can use a type ascription:
    (bSONQueryBuilder: StringAdd).self
    Definition Classes
    StringAdd
  2. val self: Any

    Implicit information
    This member is added by an implicit conversion from BSONQueryBuilder to StringFormat performed by method any2stringfmt in scala.Predef.
    Shadowing
    This implicitly inherited member is ambiguous. One or more implicitly inherited members have similar signatures, so calling this member may produce an ambiguous implicit conversion compiler error.
    To access this member you can use a type ascription:
    (bSONQueryBuilder: StringFormat).self
    Definition Classes
    StringFormat

Deprecated Value Members

  1. def filter(predicate: Document): Self

    Sets the query predicate; If unspecified, then all documents in the collection will match the predicate.

    Sets the query predicate; If unspecified, then all documents in the collection will match the predicate.

    Definition Classes
    GenericQueryBuilder
    Annotations
    @deprecated
    Deprecated

    (Since version 0.19.4) Specify the filter predicate using collection.find(..)

  2. def filter[Qry](predicate: Qry)(implicit writer: Writer[Qry]): Self

    Sets the query predicate; If unspecified, then all documents in the collection will match the predicate.

    Sets the query predicate; If unspecified, then all documents in the collection will match the predicate.

    Qry

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

    Definition Classes
    GenericQueryBuilder
    Annotations
    @deprecated
    Deprecated

    (Since version 0.19.4) Specify the filter predicate using collection.find(..)

  3. def query(selector: Document): Self

    Definition Classes
    GenericQueryBuilder
    Annotations
    @deprecated
    Deprecated

    (Since version 0.18.2) Use filter

  4. def query[Qry](selector: Qry)(implicit writer: Writer[Qry]): Self

    Definition Classes
    GenericQueryBuilder
    Annotations
    @deprecated
    Deprecated

    (Since version 0.18.2) Use filter

  5. def readPreference: ReadPreference

    The default ReadPreference

    The default ReadPreference

    Definition Classes
    GenericQueryBuilder
    Annotations
    @deprecated @inline()
    Deprecated

    (Since version 0.16.0) Internal: will be made private

  6. def updateOptions(update: (QueryOpts) ⇒ QueryOpts): Self

    Definition Classes
    GenericQueryBuilder
    Annotations
    @deprecated
    Deprecated

    (Since version 0.12.4) Use options or the separate query ops

  7. def x: BSONQueryBuilder

    Implicit information
    This member is added by an implicit conversion from BSONQueryBuilder to ArrowAssoc[BSONQueryBuilder] performed by method any2ArrowAssoc in scala.Predef.
    Shadowing
    This implicitly inherited member is ambiguous. One or more implicitly inherited members have similar signatures, so calling this member may produce an ambiguous implicit conversion compiler error.
    To access this member you can use a type ascription:
    (bSONQueryBuilder: ArrowAssoc[BSONQueryBuilder]).x
    Definition Classes
    ArrowAssoc
    Annotations
    @deprecated
    Deprecated

    (Since version 2.10.0) Use leftOfArrow instead

  8. def x: BSONQueryBuilder

    Implicit information
    This member is added by an implicit conversion from BSONQueryBuilder to Ensuring[BSONQueryBuilder] performed by method any2Ensuring in scala.Predef.
    Shadowing
    This implicitly inherited member is ambiguous. One or more implicitly inherited members have similar signatures, so calling this member may produce an ambiguous implicit conversion compiler error.
    To access this member you can use a type ascription:
    (bSONQueryBuilder: Ensuring[BSONQueryBuilder]).x
    Definition Classes
    Ensuring
    Annotations
    @deprecated
    Deprecated

    (Since version 2.10.0) Use resultOfEnsuring instead

Inherited from Serializable

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from GenericQueryBuilder[BSONSerializationPack.type]

Inherited from QueryOps

Inherited from AnyRef

Inherited from Any

Inherited by implicit conversion any2stringadd from BSONQueryBuilder to StringAdd

Inherited by implicit conversion any2stringfmt from BSONQueryBuilder to StringFormat

Inherited by implicit conversion any2ArrowAssoc from BSONQueryBuilder to ArrowAssoc[BSONQueryBuilder]

Inherited by implicit conversion any2Ensuring from BSONQueryBuilder to Ensuring[BSONQueryBuilder]

Ungrouped