/* Copyright 2010-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. */ using System; using System.Threading; using System.Threading.Tasks; using MongoDB.Bson.Serialization; namespace MongoDB.Driver { /// /// Fluent interface for find. /// /// /// This interface is not guaranteed to remain stable. Implementors should use /// . /// /// The type of the document. /// The type of the projection (same as TDocument if there is no projection). public interface IFindFluent : IAsyncCursorSource { /// /// Gets or sets the filter. /// FilterDefinition Filter { get; set; } /// /// Gets the options. /// FindOptions Options { get; } /// /// A simplified type of projection that changes the result type by using a different serializer. /// /// The type of the result. /// The result serializer. /// The fluent find interface. IFindFluent As(IBsonSerializer resultSerializer = null); /// /// Counts the number of documents. /// /// The cancellation token. /// The count. [Obsolete("Use CountDocuments instead.")] long Count(CancellationToken cancellationToken = default(CancellationToken)); /// /// Counts the number of documents. /// /// The cancellation token. /// A Task whose result is the count. [Obsolete("Use CountDocumentsAsync instead.")] Task CountAsync(CancellationToken cancellationToken = default(CancellationToken)); /// /// Counts the number of documents. /// /// /// Note: when migrating from Count to CountDocuments the following query operations must be replaced: /// /// /// +-------------+--------------------------------+ /// | Operator | Replacement | /// +=============+================================+ /// | $where | $expr | /// +-------------+--------------------------------+ /// | $near | $geoWithin with $center | /// +-------------+--------------------------------+ /// | $nearSphere | $geoWithin with $centerSphere | /// +-------------+--------------------------------+ /// /// /// The cancellation token. /// The count. long CountDocuments(CancellationToken cancellationToken = default(CancellationToken)); /// /// Counts the number of documents. /// /// /// Note: when migrating from CountAsync to CountDocumentsAsync the following query operations must be replaced: /// /// /// +-------------+--------------------------------+ /// | Operator | Replacement | /// +=============+================================+ /// | $where | $expr | /// +-------------+--------------------------------+ /// | $near | $geoWithin with $center | /// +-------------+--------------------------------+ /// | $nearSphere | $geoWithin with $centerSphere | /// +-------------+--------------------------------+ /// /// /// The cancellation token. /// A Task whose result is the count. Task CountDocumentsAsync(CancellationToken cancellationToken = default(CancellationToken)); /// /// Limits the number of documents. /// /// The limit. /// The fluent find interface. IFindFluent Limit(int? limit); /// /// Projects the the result. /// /// The type of the projection. /// The projection. /// The fluent find interface. IFindFluent Project(ProjectionDefinition projection); /// /// Skips the the specified number of documents. /// /// The skip. /// The fluent find interface. IFindFluent Skip(int? skip); /// /// Sorts the the documents. /// /// The sort. /// The fluent find interface. IFindFluent Sort(SortDefinition sort); } /// /// Fluent interface for find. /// /// The type of the document. /// The type of the projection (same as TDocument if there is no projection). public interface IOrderedFindFluent : IFindFluent { } }