com.mongodb.reactivestreams.client.gridfs.GridFSFindPublisher 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
The newest version!
/*
* Copyright 2008-present 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.gridfs;
import com.mongodb.client.gridfs.model.GridFSFile;
import com.mongodb.client.model.Collation;
import com.mongodb.lang.Nullable;
import org.bson.conversions.Bson;
import org.reactivestreams.Publisher;
import java.util.concurrent.TimeUnit;
/**
* Iterable for the GridFS Files Collection.
*
* @since 1.3
*/
public interface GridFSFindPublisher extends Publisher {
/**
* Helper to return a publisher limited first from the query.
*
* @return a publisher with a single element
*/
Publisher first();
/**
* Sets the query filter to apply to the query.
*
* Below is an example of filtering against the filename and some nested metadata that can also be stored along with the file data:
*
* {@code
* Filters.and(Filters.eq("filename", "mongodb.png"), Filters.eq("metadata.contentType", "image/png"));
* }
*
*
* @param filter the filter, which may be null.
* @return this
* @mongodb.driver.manual reference/method/db.collection.find/ Filter
* @see com.mongodb.client.model.Filters
*/
GridFSFindPublisher filter(@Nullable 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
*/
GridFSFindPublisher 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
*/
GridFSFindPublisher skip(int skip);
/**
* 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
*/
GridFSFindPublisher sort(@Nullable 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
*/
GridFSFindPublisher noCursorTimeout(boolean noCursorTimeout);
/**
* 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
*/
GridFSFindPublisher maxTime(long maxTime, TimeUnit timeUnit);
/**
* Sets the collation options
*
* A null value represents the server default.
* @param collation the collation options to use
* @return this
* @since 1.3
* @mongodb.server.release 3.4
*/
GridFSFindPublisher collation(@Nullable Collation collation);
/**
* Sets the number of documents to return per batch.
*
* Overrides the {@link org.reactivestreams.Subscription#request(long)} value for setting the batch size, allowing for fine-grained
* control over the underlying cursor.
*
* @param batchSize the batch size
* @return this
* @since 1.8
* @mongodb.driver.manual reference/method/cursor.batchSize/#cursor.batchSize Batch Size
*/
GridFSFindPublisher batchSize(int batchSize);
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy