Table of Contents

Method FindSync

Namespace
MongoDB.Driver
Assembly
MongoDB.Driver.dll

FindSync<TDocument>(IMongoCollection<TDocument>, FilterDefinition<TDocument>, FindOptions<TDocument, TDocument>, CancellationToken)

Finds the documents matching the filter.

public static IAsyncCursor<TDocument> FindSync<TDocument>(this IMongoCollection<TDocument> collection, FilterDefinition<TDocument> filter, FindOptions<TDocument, TDocument> options = null, CancellationToken cancellationToken = default)

Parameters

collection IMongoCollection<TDocument>

The collection.

filter FilterDefinition<TDocument>

The filter.

options FindOptions<TDocument, TDocument>

The options.

cancellationToken CancellationToken

The cancellation token.

Returns

IAsyncCursor<TDocument>

A Task whose result is a cursor.

Type Parameters

TDocument

The type of the document.

FindSync<TDocument>(IMongoCollection<TDocument>, Expression<Func<TDocument, bool>>, FindOptions<TDocument, TDocument>, CancellationToken)

Finds the documents matching the filter.

public static IAsyncCursor<TDocument> FindSync<TDocument>(this IMongoCollection<TDocument> collection, Expression<Func<TDocument, bool>> filter, FindOptions<TDocument, TDocument> options = null, CancellationToken cancellationToken = default)

Parameters

collection IMongoCollection<TDocument>

The collection.

filter Expression<Func<TDocument, bool>>

The filter.

options FindOptions<TDocument, TDocument>

The options.

cancellationToken CancellationToken

The cancellation token.

Returns

IAsyncCursor<TDocument>

A Task whose result is a cursor.

Type Parameters

TDocument

The type of the document.

FindSync<TDocument>(IMongoCollection<TDocument>, IClientSessionHandle, FilterDefinition<TDocument>, FindOptions<TDocument, TDocument>, CancellationToken)

Finds the documents matching the filter.

public static IAsyncCursor<TDocument> FindSync<TDocument>(this IMongoCollection<TDocument> collection, IClientSessionHandle session, FilterDefinition<TDocument> filter, FindOptions<TDocument, TDocument> options = null, CancellationToken cancellationToken = default)

Parameters

collection IMongoCollection<TDocument>

The collection.

session IClientSessionHandle

The session.

filter FilterDefinition<TDocument>

The filter.

options FindOptions<TDocument, TDocument>

The options.

cancellationToken CancellationToken

The cancellation token.

Returns

IAsyncCursor<TDocument>

A Task whose result is a cursor.

Type Parameters

TDocument

The type of the document.

FindSync<TDocument>(IMongoCollection<TDocument>, IClientSessionHandle, Expression<Func<TDocument, bool>>, FindOptions<TDocument, TDocument>, CancellationToken)

Finds the documents matching the filter.

public static IAsyncCursor<TDocument> FindSync<TDocument>(this IMongoCollection<TDocument> collection, IClientSessionHandle session, Expression<Func<TDocument, bool>> filter, FindOptions<TDocument, TDocument> options = null, CancellationToken cancellationToken = default)

Parameters

collection IMongoCollection<TDocument>

The collection.

session IClientSessionHandle

The session.

filter Expression<Func<TDocument, bool>>

The filter.

options FindOptions<TDocument, TDocument>

The options.

cancellationToken CancellationToken

The cancellation token.

Returns

IAsyncCursor<TDocument>

A Task whose result is a cursor.

Type Parameters

TDocument

The type of the document.