Class FindOptions

java.lang.Object
io.quarkus.mongodb.FindOptions

public class FindOptions extends Object
Stream options for find.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    <T> com.mongodb.reactivestreams.client.FindPublisher<T>
    apply(com.mongodb.reactivestreams.client.FindPublisher<T> stream)
     
    batchSize(int size)
    Sets the number of documents to return per batch.
    collation(com.mongodb.client.model.Collation collation)
    Sets the collation options
    comment(String comment)
    Sets the comment to the query.
    cursorType(com.mongodb.CursorType cursorType)
    Sets the cursor type.
    filter(org.bson.conversions.Bson filter)
    Sets the query filter to apply to the query.
    hint(org.bson.conversions.Bson hint)
    Sets the hint for which index to use.
    limit(int limit)
    Sets the limit to apply.
    max(org.bson.conversions.Bson max)
    Sets the exclusive upper bound for a specific index.
    maxAwaitTime(long maxAwaitTime, TimeUnit timeUnit)
    The maximum amount of time for the server to wait on new documents to satisfy a tailable cursor query.
    maxTime(long maxTime, TimeUnit timeUnit)
    Sets the maximum execution time on the server for this operation.
    min(org.bson.conversions.Bson min)
    Sets the minimum inclusive lower bound for a specific index.
    noCursorTimeout(boolean noCursorTimeout)
    The server normally times out idle cursors after an inactivity period (10 minutes) to prevent excess memory use.
    oplogReplay(boolean oplogReplay)
    Users should not set this under normal circumstances.
    partial(boolean partial)
    Get partial results from a sharded cluster if one or more shards are unreachable (instead of throwing an error).
    projection(org.bson.conversions.Bson projection)
    Sets a document describing the fields to return for all matching documents.
    returnKey(boolean returnKey)
    Sets the returnKey.
    showRecordId(boolean showRecordId)
    Sets the showRecordId.
    skip(int skip)
    Sets the number of documents to skip.
    sort(org.bson.conversions.Bson sort)
    Sets the sort criteria to apply to the query.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • FindOptions

      public FindOptions()
  • Method Details

    • filter

      public FindOptions filter(org.bson.conversions.Bson filter)
      Sets the query filter to apply to the query.
      Parameters:
      filter - the filter, which may be null.
      Returns:
      this
    • limit

      public FindOptions limit(int limit)
      Sets the limit to apply.
      Parameters:
      limit - the limit, which may be null
      Returns:
      this
    • skip

      public FindOptions skip(int skip)
      Sets the number of documents to skip.
      Parameters:
      skip - the number of documents to skip
      Returns:
      this
    • maxTime

      public FindOptions maxTime(long maxTime, TimeUnit timeUnit)
      Sets the maximum execution time on the server for this operation.
      Parameters:
      maxTime - the max time
      timeUnit - the time unit, which may not be null
      Returns:
      this
    • maxAwaitTime

      public FindOptions maxAwaitTime(long maxAwaitTime, TimeUnit timeUnit)
      The maximum amount of time for the server to wait on new documents to satisfy a tailable cursor query. This only applies to a TAILABLE_AWAIT cursor. When the cursor is not a TAILABLE_AWAIT cursor, this option is ignored.

      On servers >= 3.2, this option will be specified on the getMore command as "maxTimeMS". The default is no value: no "maxTimeMS" is sent to the server with the getMore command.

      On servers < 3.2, this option is ignored, and indicates that the driver should respect the server's default value

      A zero value will be ignored.

      Parameters:
      maxAwaitTime - the max await time
      timeUnit - the time unit to return the result in
      Returns:
      the maximum await execution time in the given time unit
    • projection

      public FindOptions projection(org.bson.conversions.Bson projection)
      Sets a document describing the fields to return for all matching documents.
      Parameters:
      projection - the project document, which may be null.
      Returns:
      this
    • sort

      public FindOptions sort(org.bson.conversions.Bson sort)
      Sets the sort criteria to apply to the query.
      Parameters:
      sort - the sort criteria, which may be null.
      Returns:
      this
    • noCursorTimeout

      public FindOptions noCursorTimeout(boolean noCursorTimeout)
      The server normally times out idle cursors after an inactivity period (10 minutes) to prevent excess memory use. Set this option to prevent that.
      Parameters:
      noCursorTimeout - true if cursor timeout is disabled
      Returns:
      this
    • oplogReplay

      public FindOptions oplogReplay(boolean oplogReplay)
      Users should not set this under normal circumstances.
      Parameters:
      oplogReplay - if oplog replay is enabled
      Returns:
      this
    • partial

      public FindOptions partial(boolean partial)
      Get partial results from a sharded cluster if one or more shards are unreachable (instead of throwing an error).
      Parameters:
      partial - if partial results for sharded clusters is enabled
      Returns:
      this
    • cursorType

      public FindOptions cursorType(com.mongodb.CursorType cursorType)
      Sets the cursor type.
      Parameters:
      cursorType - the cursor type
      Returns:
      this
    • collation

      public FindOptions collation(com.mongodb.client.model.Collation collation)
      Sets the collation options

      A null value represents the server default.

      Parameters:
      collation - the collation options to use
      Returns:
      this
    • comment

      public FindOptions comment(String comment)
      Sets the comment to the query. A null value means no comment is set.
      Parameters:
      comment - the comment
      Returns:
      this
    • hint

      public FindOptions hint(org.bson.conversions.Bson hint)
      Sets the hint for which index to use. A null value means no hint is set.
      Parameters:
      hint - the hint
      Returns:
      this
    • max

      public FindOptions max(org.bson.conversions.Bson max)
      Sets the exclusive upper bound for a specific index. A null value means no max is set.
      Parameters:
      max - the max
      Returns:
      this
    • min

      public FindOptions min(org.bson.conversions.Bson min)
      Sets the minimum inclusive lower bound for a specific index. A null value means no max is set.
      Parameters:
      min - the min
      Returns:
      this
    • returnKey

      public FindOptions returnKey(boolean returnKey)
      Sets the returnKey. If true the find operation will return only the index keys in the resulting documents.
      Parameters:
      returnKey - the returnKey
      Returns:
      this
    • showRecordId

      public FindOptions showRecordId(boolean showRecordId)
      Sets the showRecordId. Set to true to add a field $recordId to the returned documents.
      Parameters:
      showRecordId - the showRecordId
      Returns:
      this
    • batchSize

      public FindOptions batchSize(int size)
      Sets the number of documents to return per batch.

      Overrides the Subscription.request(long) value for setting the batch size, allowing for fine grained control over the underlying cursor.

      Parameters:
      size - the batch size
      Returns:
      this
    • apply

      public <T> com.mongodb.reactivestreams.client.FindPublisher<T> apply(com.mongodb.reactivestreams.client.FindPublisher<T> stream)