
com.mongodb.reactivestreams.client.FindPublisher Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mongodb-driver-reactivestreams Show documentation
Show all versions of mongodb-driver-reactivestreams Show documentation
A Reactive Streams implementation of the MongoDB Java driver
/*
* Copyright 2015 MongoDB, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.mongodb.reactivestreams.client;
import com.mongodb.CursorType;
import org.bson.conversions.Bson;
import org.reactivestreams.Publisher;
import java.util.concurrent.TimeUnit;
/**
* Publisher interface for find.
*
* @param The type of the result.
* @since 1.0
*/
public interface FindPublisher extends Publisher {
/**
* Helper to return a publisher limited first from the query.
*
* @return a Publisher which will
*/
Publisher first();
/**
* Sets the query filter to apply to the query.
*
* @param filter the filter, which may be null.
* @return this
* @mongodb.driver.manual reference/method/db.collection.find/ Filter
*/
FindPublisher filter(Bson filter);
/**
* Sets the limit to apply.
*
* @param limit the limit, which may be null
* @return this
* @mongodb.driver.manual reference/method/cursor.limit/#cursor.limit Limit
*/
FindPublisher limit(int limit);
/**
* Sets the number of documents to skip.
*
* @param skip the number of documents to skip
* @return this
* @mongodb.driver.manual reference/method/cursor.skip/#cursor.skip Skip
*/
FindPublisher skip(int skip);
/**
* Sets the maximum execution time on the server for this operation.
*
* @param maxTime the max time
* @param timeUnit the time unit, which may not be null
* @return this
* @mongodb.driver.manual reference/method/cursor.maxTimeMS/#cursor.maxTimeMS Max Time
*/
FindPublisher maxTime(long maxTime, 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.
*
* @param maxAwaitTime the max await time
* @param timeUnit the time unit to return the result in
* @return the maximum await execution time in the given time unit
* @mongodb.driver.manual reference/method/cursor.maxTimeMS/#cursor.maxTimeMS Max Time
* @since 1.2
*/
FindPublisher maxAwaitTime(long maxAwaitTime, TimeUnit timeUnit);
/**
* Sets the query modifiers to apply to this operation.
*
* @param modifiers the query modifiers to apply, which may be null.
* @return this
* @mongodb.driver.manual reference/operator/query-modifier/ Query Modifiers
*/
FindPublisher modifiers(Bson modifiers);
/**
* Sets a document describing the fields to return for all matching documents.
*
* @param projection the project document, which may be null.
* @return this
* @mongodb.driver.manual reference/method/db.collection.find/ Projection
*/
FindPublisher projection(Bson projection);
/**
* Sets the sort criteria to apply to the query.
*
* @param sort the sort criteria, which may be null.
* @return this
* @mongodb.driver.manual reference/method/cursor.sort/ Sort
*/
FindPublisher sort(Bson sort);
/**
* The server normally times out idle cursors after an inactivity period (10 minutes)
* to prevent excess memory use. Set this option to prevent that.
*
* @param noCursorTimeout true if cursor timeout is disabled
* @return this
*/
FindPublisher noCursorTimeout(boolean noCursorTimeout);
/**
* Users should not set this under normal circumstances.
*
* @param oplogReplay if oplog replay is enabled
* @return this
*/
FindPublisher oplogReplay(boolean oplogReplay);
/**
* Get partial results from a sharded cluster if one or more shards are unreachable (instead of throwing an error).
*
* @param partial if partial results for sharded clusters is enabled
* @return this
*/
FindPublisher partial(boolean partial);
/**
* Sets the cursor type.
*
* @param cursorType the cursor type
* @return this
*/
FindPublisher cursorType(CursorType cursorType);
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy