reformatting

This commit is contained in:
Sean Garrett
2023-07-06 13:00:55 +01:00
parent c70727212e
commit 26b71ff76e
24 changed files with 3041 additions and 980 deletions
@@ -25,7 +25,11 @@ namespace MongoDbGenericRepository
/// <param name="skipNumber">The number of documents you want to skip. Default value is 0.</param> /// <param name="skipNumber">The number of documents you want to skip. Default value is 0.</param>
/// <param name="takeNumber">The number of documents you want to take. Default value is 50.</param> /// <param name="takeNumber">The number of documents you want to take. Default value is 50.</param>
/// <param name="partitionKey">An optional partition key.</param> /// <param name="partitionKey">An optional partition key.</param>
Task<List<TDocument>> GetPaginatedAsync<TDocument>(Expression<Func<TDocument, bool>> filter, int skipNumber = 0, int takeNumber = 50, string partitionKey = null) Task<List<TDocument>> GetPaginatedAsync<TDocument>(
Expression<Func<TDocument, bool>> filter,
int skipNumber = 0,
int takeNumber = 50,
string partitionKey = null)
where TDocument : IDocument; where TDocument : IDocument;
/// <summary> /// <summary>
@@ -37,7 +41,11 @@ namespace MongoDbGenericRepository
/// <param name="skipNumber">The number of documents you want to skip. Default value is 0.</param> /// <param name="skipNumber">The number of documents you want to skip. Default value is 0.</param>
/// <param name="takeNumber">The number of documents you want to take. Default value is 50.</param> /// <param name="takeNumber">The number of documents you want to take. Default value is 50.</param>
/// <param name="partitionKey">An optional partition key.</param> /// <param name="partitionKey">An optional partition key.</param>
Task<List<TDocument>> GetPaginatedAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, int skipNumber = 0, int takeNumber = 50, string partitionKey = null) Task<List<TDocument>> GetPaginatedAsync<TDocument, TKey>(
Expression<Func<TDocument, bool>> filter,
int skipNumber = 0,
int takeNumber = 50,
string partitionKey = null)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
@@ -49,7 +57,10 @@ namespace MongoDbGenericRepository
/// <param name="update"></param> /// <param name="update"></param>
/// <param name="options"></param> /// <param name="options"></param>
/// <returns></returns> /// <returns></returns>
Task<TDocument> GetAndUpdateOne<TDocument>(FilterDefinition<TDocument> filter, UpdateDefinition<TDocument> update, FindOneAndUpdateOptions<TDocument, TDocument> options) Task<TDocument> GetAndUpdateOne<TDocument>(
FilterDefinition<TDocument> filter,
UpdateDefinition<TDocument> update,
FindOneAndUpdateOptions<TDocument, TDocument> options)
where TDocument : IDocument; where TDocument : IDocument;
/// <summary> /// <summary>
@@ -61,7 +72,10 @@ namespace MongoDbGenericRepository
/// <param name="update"></param> /// <param name="update"></param>
/// <param name="options"></param> /// <param name="options"></param>
/// <returns></returns> /// <returns></returns>
Task<TDocument> GetAndUpdateOne<TDocument, TKey>(FilterDefinition<TDocument> filter, UpdateDefinition<TDocument> update, FindOneAndUpdateOptions<TDocument, TDocument> options) Task<TDocument> GetAndUpdateOne<TDocument, TKey>(
FilterDefinition<TDocument> filter,
UpdateDefinition<TDocument> update,
FindOneAndUpdateOptions<TDocument, TDocument> options)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
} }
@@ -2,6 +2,7 @@
using MongoDbGenericRepository.Models; using MongoDbGenericRepository.Models;
using System; using System;
using System.Linq.Expressions; using System.Linq.Expressions;
using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace MongoDbGenericRepository namespace MongoDbGenericRepository
@@ -21,6 +22,17 @@ namespace MongoDbGenericRepository
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary>
/// Asynchronously Updates a document.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <param name="modifiedDocument">The document with the modifications you want to persist.</param>
/// <param name="cancellationToken">The cancellation token.</param>
Task<bool> UpdateOneAsync<TDocument, TKey>(TDocument modifiedDocument, CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Updates a document. /// Updates a document.
/// </summary> /// </summary>
@@ -31,6 +43,17 @@ namespace MongoDbGenericRepository
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary>
/// Updates a document.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <param name="modifiedDocument">The document with the modifications you want to persist.</param>
/// <param name="cancellationToken">The cancellation token.</param>
bool UpdateOne<TDocument, TKey>(TDocument modifiedDocument, CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Takes a document you want to modify and applies the update you have defined in MongoDb. /// Takes a document you want to modify and applies the update you have defined in MongoDb.
/// </summary> /// </summary>
@@ -42,6 +65,18 @@ namespace MongoDbGenericRepository
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary>
/// Takes a document you want to modify and applies the update you have defined in MongoDb.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <param name="documentToModify">The document you want to modify.</param>
/// <param name="update">The update definition for the document.</param>
/// <param name="cancellationToken">The cancellation token.</param>
Task<bool> UpdateOneAsync<TDocument, TKey>(TDocument documentToModify, UpdateDefinition<TDocument> update, CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Takes a document you want to modify and applies the update you have defined in MongoDb. /// Takes a document you want to modify and applies the update you have defined in MongoDb.
/// </summary> /// </summary>
@@ -53,6 +88,45 @@ namespace MongoDbGenericRepository
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary>
/// Takes a document you want to modify and applies the update you have defined in MongoDb.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <param name="documentToModify">The document you want to modify.</param>
/// <param name="update">The update definition for the document.</param>
/// <param name="cancellationToken">The cancellation token.</param>
bool UpdateOne<TDocument, TKey>(TDocument documentToModify, UpdateDefinition<TDocument> update, CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// For the entity selected by the filter, updates the property field with the given value..
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <typeparam name="TField">The type of the field.</typeparam>
/// <param name="filter">The document filter.</param>
/// <param name="field">The field selector.</param>
/// <param name="value">The new value of the property field.</param>
bool UpdateOne<TDocument, TKey, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// For the entity selected by the filter, updates the property field with the given value..
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <typeparam name="TField">The type of the field.</typeparam>
/// <param name="filter">The document filter.</param>
/// <param name="field">The field selector.</param>
/// <param name="value">The new value of the property field.</param>
/// <param name="cancellationToken">The cancellation token.</param>
bool UpdateOne<TDocument, TKey, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// For the entity selected by the filter, updates the property field with the given value.. /// For the entity selected by the filter, updates the property field with the given value..
/// </summary> /// </summary>
@@ -63,7 +137,22 @@ namespace MongoDbGenericRepository
/// <param name="field">The field selector.</param> /// <param name="field">The field selector.</param>
/// <param name="value">The new value of the property field.</param> /// <param name="value">The new value of the property field.</param>
/// <param name="partitionKey">The partition key for the document.</param> /// <param name="partitionKey">The partition key for the document.</param>
bool UpdateOne<TDocument, TKey, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey = null) bool UpdateOne<TDocument, TKey, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// For the entity selected by the filter, updates the property field with the given value..
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <typeparam name="TField">The type of the field.</typeparam>
/// <param name="filter">The document filter.</param>
/// <param name="field">The field selector.</param>
/// <param name="value">The new value of the property field.</param>
/// <param name="partitionKey">The partition key for the document.</param>
/// <param name="cancellationToken">The cancellation token.</param>
bool UpdateOne<TDocument, TKey, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey, CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
@@ -80,6 +169,47 @@ namespace MongoDbGenericRepository
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary>
/// Updates the property field with the given value update a property field in entities.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <typeparam name="TField">The type of the field.</typeparam>
/// <param name="documentToModify">The document you want to modify.</param>
/// <param name="field">The field selector.</param>
/// <param name="value">The new value of the property field.</param>
/// <param name="cancellationToken">The cancellation token.</param>
Task<bool> UpdateOneAsync<TDocument, TKey, TField>(TDocument documentToModify, Expression<Func<TDocument, TField>> field, TField value, CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// For the entity selected by the filter, updates the property field with the given value.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <typeparam name="TField">The type of the field.</typeparam>
/// <param name="filter">The document filter.</param>
/// <param name="field">The field selector.</param>
/// <param name="value">The new value of the property field.</param>
Task<bool> UpdateOneAsync<TDocument, TKey, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// For the entity selected by the filter, updates the property field with the given value.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <typeparam name="TField">The type of the field.</typeparam>
/// <param name="filter">The document filter.</param>
/// <param name="field">The field selector.</param>
/// <param name="value">The new value of the property field.</param>
/// <param name="cancellationToken">The cancellation token.</param>
Task<bool> UpdateOneAsync<TDocument, TKey, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// For the entity selected by the filter, updates the property field with the given value. /// For the entity selected by the filter, updates the property field with the given value.
/// </summary> /// </summary>
@@ -90,7 +220,22 @@ namespace MongoDbGenericRepository
/// <param name="field">The field selector.</param> /// <param name="field">The field selector.</param>
/// <param name="value">The new value of the property field.</param> /// <param name="value">The new value of the property field.</param>
/// <param name="partitionKey">The partition key for the document.</param> /// <param name="partitionKey">The partition key for the document.</param>
Task<bool> UpdateOneAsync<TDocument, TKey, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey = null) Task<bool> UpdateOneAsync<TDocument, TKey, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// For the entity selected by the filter, updates the property field with the given value.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <typeparam name="TField">The type of the field.</typeparam>
/// <param name="filter">The document filter.</param>
/// <param name="field">The field selector.</param>
/// <param name="value">The new value of the property field.</param>
/// <param name="partitionKey">The partition key for the document.</param>
/// <param name="cancellationToken">The cancellation token.</param>
Task<bool> UpdateOneAsync<TDocument, TKey, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey, CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
@@ -107,6 +252,20 @@ namespace MongoDbGenericRepository
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary>
/// Updates the property field with the given value update a property field in entities.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <typeparam name="TField">The type of the field.</typeparam>
/// <param name="documentToModify">The document you want to modify.</param>
/// <param name="field">The field selector.</param>
/// <param name="value">The new value of the property field.</param>
/// <param name="cancellationToken">The cancellation token.</param>
bool UpdateOne<TDocument, TKey, TField>(TDocument documentToModify, Expression<Func<TDocument, TField>> field, TField value, CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Updates the property field with the given value update a property field in entities. /// Updates the property field with the given value update a property field in entities.
/// </summary> /// </summary>
@@ -116,8 +275,21 @@ namespace MongoDbGenericRepository
/// <param name="filter">The document filter.</param> /// <param name="filter">The document filter.</param>
/// <param name="field">The field selector.</param> /// <param name="field">The field selector.</param>
/// <param name="value">The new value of the property field.</param> /// <param name="value">The new value of the property field.</param>
/// <param name="partitionKey">The value of the partition key.</param> Task<bool> UpdateOneAsync<TDocument, TKey, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value)
Task<bool> UpdateOneAsync<TDocument, TKey, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey = null) where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// Updates the property field with the given value update a property field in entities.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <typeparam name="TField">The type of the field.</typeparam>
/// <param name="filter">The document filter.</param>
/// <param name="field">The field selector.</param>
/// <param name="value">The new value of the property field.</param>
/// <param name="cancellationToken">The cancellation token.</param>
Task<bool> UpdateOneAsync<TDocument, TKey, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
@@ -131,7 +303,105 @@ namespace MongoDbGenericRepository
/// <param name="field">The field selector.</param> /// <param name="field">The field selector.</param>
/// <param name="value">The new value of the property field.</param> /// <param name="value">The new value of the property field.</param>
/// <param name="partitionKey">The value of the partition key.</param> /// <param name="partitionKey">The value of the partition key.</param>
bool UpdateOne<TDocument, TKey, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey = null) Task<bool> UpdateOneAsync<TDocument, TKey, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// Updates the property field with the given value update a property field in entities.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <typeparam name="TField">The type of the field.</typeparam>
/// <param name="filter">The document filter.</param>
/// <param name="field">The field selector.</param>
/// <param name="value">The new value of the property field.</param>
/// <param name="partitionKey">The value of the partition key.</param>
/// <param name="cancellationToken">The cancellation token.</param>
Task<bool> UpdateOneAsync<TDocument, TKey, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey, CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// Updates the property field with the given value update a property field in entities.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <typeparam name="TField">The type of the field.</typeparam>
/// <param name="filter">The document filter.</param>
/// <param name="field">The field selector.</param>
/// <param name="value">The new value of the property field.</param>
bool UpdateOne<TDocument, TKey, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// Updates the property field with the given value update a property field in entities.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <typeparam name="TField">The type of the field.</typeparam>
/// <param name="filter">The document filter.</param>
/// <param name="field">The field selector.</param>
/// <param name="value">The new value of the property field.</param>
/// <param name="cancellationToken">The cancellation token.</param>
bool UpdateOne<TDocument, TKey, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// Updates the property field with the given value update a property field in entities.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <typeparam name="TField">The type of the field.</typeparam>
/// <param name="filter">The document filter.</param>
/// <param name="field">The field selector.</param>
/// <param name="value">The new value of the property field.</param>
/// <param name="partitionKey">The value of the partition key.</param>
bool UpdateOne<TDocument, TKey, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// Updates the property field with the given value update a property field in entities.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <typeparam name="TField">The type of the field.</typeparam>
/// <param name="filter">The document filter.</param>
/// <param name="field">The field selector.</param>
/// <param name="value">The new value of the property field.</param>
/// <param name="partitionKey">The value of the partition key.</param>
/// <param name="cancellationToken">The cancellation token.</param>
bool UpdateOne<TDocument, TKey, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey, CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// For the entities selected by the filter, updates the property field with the given value.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <typeparam name="TField">The type of the field.</typeparam>
/// <param name="filter">The document filter.</param>
/// <param name="field">The field selector.</param>
/// <param name="value">The new value of the property field.</param>
Task<long> UpdateManyAsync<TDocument, TKey, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// For the entities selected by the filter, updates the property field with the given value.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <typeparam name="TField">The type of the field.</typeparam>
/// <param name="filter">The document filter.</param>
/// <param name="field">The field selector.</param>
/// <param name="value">The new value of the property field.</param>
/// <param name="cancellationToken">The cancellation token.</param>
Task<long> UpdateManyAsync<TDocument, TKey, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
@@ -145,45 +415,7 @@ namespace MongoDbGenericRepository
/// <param name="field">The field selector.</param> /// <param name="field">The field selector.</param>
/// <param name="value">The new value of the property field.</param> /// <param name="value">The new value of the property field.</param>
/// <param name="partitionKey">The partition key for the document.</param> /// <param name="partitionKey">The partition key for the document.</param>
Task<long> UpdateManyAsync<TDocument, TKey, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey = null) Task<long> UpdateManyAsync<TDocument, TKey, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// For the entities selected by the filter, updates the property field with the given value.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <typeparam name="TField">The type of the field.</typeparam>
/// <param name="filter">The document filter.</param>
/// <param name="field">The field selector.</param>
/// <param name="value">The new value of the property field.</param>
/// <param name="partitionKey">The value of the partition key.</param>
Task<long> UpdateManyAsync<TDocument, TKey, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey = null)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// For the entities selected by the filter, applies the update you have defined in MongoDb.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <param name="filter">The document filter.</param>
/// <param name="updateDefinition">The update definition to apply.</param>
/// <param name="partitionKey">The value of the partition key.</param>
Task<long> UpdateManyAsync<TDocument, TKey>(FilterDefinition<TDocument> filter, UpdateDefinition<TDocument> updateDefinition, string partitionKey = null)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// For the entities selected by the filter, applies the update you have defined in MongoDb.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <param name="filter">The document filter.</param>
/// <param name="updateDefinition">The update definition to apply.</param>
/// <param name="partitionKey">The value of the partition key.</param>
Task<long> UpdateManyAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, UpdateDefinition<TDocument> updateDefinition, string partitionKey = null)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
@@ -197,7 +429,35 @@ namespace MongoDbGenericRepository
/// <param name="field">The field selector.</param> /// <param name="field">The field selector.</param>
/// <param name="value">The new value of the property field.</param> /// <param name="value">The new value of the property field.</param>
/// <param name="partitionKey">The partition key for the document.</param> /// <param name="partitionKey">The partition key for the document.</param>
long UpdateMany<TDocument, TKey, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey = null) /// <param name="cancellationToken">The cancellation token.</param>
Task<long> UpdateManyAsync<TDocument, TKey, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey, CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// For the entities selected by the filter, updates the property field with the given value.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <typeparam name="TField">The type of the field.</typeparam>
/// <param name="filter">The document filter.</param>
/// <param name="field">The field selector.</param>
/// <param name="value">The new value of the property field.</param>
Task<long> UpdateManyAsync<TDocument, TKey, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// For the entities selected by the filter, updates the property field with the given value.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <typeparam name="TField">The type of the field.</typeparam>
/// <param name="filter">The document filter.</param>
/// <param name="field">The field selector.</param>
/// <param name="value">The new value of the property field.</param>
/// <param name="cancellationToken">The cancellation token.</param>
Task<long> UpdateManyAsync<TDocument, TKey, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
@@ -211,7 +471,45 @@ namespace MongoDbGenericRepository
/// <param name="field">The field selector.</param> /// <param name="field">The field selector.</param>
/// <param name="value">The new value of the property field.</param> /// <param name="value">The new value of the property field.</param>
/// <param name="partitionKey">The value of the partition key.</param> /// <param name="partitionKey">The value of the partition key.</param>
long UpdateMany<TDocument, TKey, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey = null) Task<long> UpdateManyAsync<TDocument, TKey, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// For the entities selected by the filter, updates the property field with the given value.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <typeparam name="TField">The type of the field.</typeparam>
/// <param name="filter">The document filter.</param>
/// <param name="field">The field selector.</param>
/// <param name="value">The new value of the property field.</param>
/// <param name="partitionKey">The value of the partition key.</param>
/// <param name="cancellationToken">The cancellation token.</param>
Task<long> UpdateManyAsync<TDocument, TKey, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey, CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// For the entities selected by the filter, applies the update you have defined in MongoDb.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <param name="filter">The document filter.</param>
/// <param name="updateDefinition">The update definition to apply.</param>
Task<long> UpdateManyAsync<TDocument, TKey>(FilterDefinition<TDocument> filter, UpdateDefinition<TDocument> updateDefinition)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// For the entities selected by the filter, applies the update you have defined in MongoDb.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <param name="filter">The document filter.</param>
/// <param name="updateDefinition">The update definition to apply.</param>
/// <param name="cancellationToken">The cancellation token.</param>
Task<long> UpdateManyAsync<TDocument, TKey>(FilterDefinition<TDocument> filter, UpdateDefinition<TDocument> updateDefinition, CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
@@ -223,7 +521,7 @@ namespace MongoDbGenericRepository
/// <param name="filter">The document filter.</param> /// <param name="filter">The document filter.</param>
/// <param name="updateDefinition">The update definition to apply.</param> /// <param name="updateDefinition">The update definition to apply.</param>
/// <param name="partitionKey">The value of the partition key.</param> /// <param name="partitionKey">The value of the partition key.</param>
long UpdateMany<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, UpdateDefinition<TDocument> updateDefinition, string partitionKey = null) Task<long> UpdateManyAsync<TDocument, TKey>(FilterDefinition<TDocument> filter, UpdateDefinition<TDocument> updateDefinition, string partitionKey)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
@@ -235,8 +533,265 @@ namespace MongoDbGenericRepository
/// <param name="filter">The document filter.</param> /// <param name="filter">The document filter.</param>
/// <param name="updateDefinition">The update definition to apply.</param> /// <param name="updateDefinition">The update definition to apply.</param>
/// <param name="partitionKey">The value of the partition key.</param> /// <param name="partitionKey">The value of the partition key.</param>
long UpdateMany<TDocument, TKey>(FilterDefinition<TDocument> filter, UpdateDefinition<TDocument> updateDefinition, string partitionKey = null) /// <param name="cancellationToken">The cancellation token.</param>
Task<long> UpdateManyAsync<TDocument, TKey>(FilterDefinition<TDocument> filter, UpdateDefinition<TDocument> updateDefinition, string partitionKey, CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// For the entities selected by the filter, applies the update you have defined in MongoDb.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <param name="filter">The document filter.</param>
/// <param name="updateDefinition">The update definition to apply.</param>
Task<long> UpdateManyAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, UpdateDefinition<TDocument> updateDefinition)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// For the entities selected by the filter, applies the update you have defined in MongoDb.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <param name="filter">The document filter.</param>
/// <param name="updateDefinition">The update definition to apply.</param>
/// <param name="cancellationToken">The cancellation token.</param>
Task<long> UpdateManyAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, UpdateDefinition<TDocument> updateDefinition, CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// For the entities selected by the filter, applies the update you have defined in MongoDb.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <param name="filter">The document filter.</param>
/// <param name="updateDefinition">The update definition to apply.</param>
/// <param name="partitionKey">The value of the partition key.</param>
Task<long> UpdateManyAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, UpdateDefinition<TDocument> updateDefinition, string partitionKey)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// For the entities selected by the filter, applies the update you have defined in MongoDb.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <param name="filter">The document filter.</param>
/// <param name="updateDefinition">The update definition to apply.</param>
/// <param name="partitionKey">The value of the partition key.</param>
/// <param name="cancellationToken">The cancellation token.</param>
Task<long> UpdateManyAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, UpdateDefinition<TDocument> updateDefinition, string partitionKey, CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// For the entities selected by the filter, updates the property field with the given value.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <typeparam name="TField">The type of the field.</typeparam>
/// <param name="filter">The document filter.</param>
/// <param name="field">The field selector.</param>
/// <param name="value">The new value of the property field.</param>
long UpdateMany<TDocument, TKey, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// For the entities selected by the filter, updates the property field with the given value.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <typeparam name="TField">The type of the field.</typeparam>
/// <param name="filter">The document filter.</param>
/// <param name="field">The field selector.</param>
/// <param name="value">The new value of the property field.</param>
/// <param name="cancellationToken">The cancellation token.</param>
long UpdateMany<TDocument, TKey, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// For the entities selected by the filter, updates the property field with the given value.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <typeparam name="TField">The type of the field.</typeparam>
/// <param name="filter">The document filter.</param>
/// <param name="field">The field selector.</param>
/// <param name="value">The new value of the property field.</param>
/// <param name="partitionKey">The partition key for the document.</param>
long UpdateMany<TDocument, TKey, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// For the entities selected by the filter, updates the property field with the given value.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <typeparam name="TField">The type of the field.</typeparam>
/// <param name="filter">The document filter.</param>
/// <param name="field">The field selector.</param>
/// <param name="value">The new value of the property field.</param>
/// <param name="partitionKey">The partition key for the document.</param>
/// <param name="cancellationToken">The cancellation token.</param>
long UpdateMany<TDocument, TKey, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey, CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// For the entities selected by the filter, updates the property field with the given value.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <typeparam name="TField">The type of the field.</typeparam>
/// <param name="filter">The document filter.</param>
/// <param name="field">The field selector.</param>
/// <param name="value">The new value of the property field.</param>
long UpdateMany<TDocument, TKey, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// For the entities selected by the filter, updates the property field with the given value.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <typeparam name="TField">The type of the field.</typeparam>
/// <param name="filter">The document filter.</param>
/// <param name="field">The field selector.</param>
/// <param name="value">The new value of the property field.</param>
/// <param name="cancellationToken">The cancellation token.</param>
long UpdateMany<TDocument, TKey, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// For the entities selected by the filter, updates the property field with the given value.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <typeparam name="TField">The type of the field.</typeparam>
/// <param name="filter">The document filter.</param>
/// <param name="field">The field selector.</param>
/// <param name="value">The new value of the property field.</param>
/// <param name="partitionKey">The value of the partition key.</param>
long UpdateMany<TDocument, TKey, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// For the entities selected by the filter, updates the property field with the given value.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <typeparam name="TField">The type of the field.</typeparam>
/// <param name="filter">The document filter.</param>
/// <param name="field">The field selector.</param>
/// <param name="value">The new value of the property field.</param>
/// <param name="partitionKey">The value of the partition key.</param>
/// <param name="cancellationToken">The cancellation token.</param>
long UpdateMany<TDocument, TKey, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey, CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// For the entities selected by the filter, applies the update you have defined in MongoDb.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <param name="filter">The document filter.</param>
/// <param name="updateDefinition">The update definition to apply.</param>
long UpdateMany<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, UpdateDefinition<TDocument> updateDefinition)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// For the entities selected by the filter, applies the update you have defined in MongoDb.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <param name="filter">The document filter.</param>
/// <param name="updateDefinition">The update definition to apply.</param>
/// <param name="cancellationToken">The cancellation token.</param>
long UpdateMany<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, UpdateDefinition<TDocument> updateDefinition, CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// For the entities selected by the filter, applies the update you have defined in MongoDb.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <param name="filter">The document filter.</param>
/// <param name="updateDefinition">The update definition to apply.</param>
/// <param name="partitionKey">The value of the partition key.</param>
long UpdateMany<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, UpdateDefinition<TDocument> updateDefinition, string partitionKey)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// For the entities selected by the filter, applies the update you have defined in MongoDb.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <param name="filter">The document filter.</param>
/// <param name="updateDefinition">The update definition to apply.</param>
/// <param name="partitionKey">The value of the partition key.</param>
/// <param name="cancellationToken">The cancellation token.</param>
long UpdateMany<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, UpdateDefinition<TDocument> updateDefinition, string partitionKey, CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// For the entities selected by the filter, applies the update you have defined in MongoDb.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <param name="filter">The document filter.</param>
/// <param name="updateDefinition">The update definition to apply.</param>
long UpdateMany<TDocument, TKey>(FilterDefinition<TDocument> filter, UpdateDefinition<TDocument> updateDefinition)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// For the entities selected by the filter, applies the update you have defined in MongoDb.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <param name="filter">The document filter.</param>
/// <param name="updateDefinition">The update definition to apply.</param>
/// <param name="cancellationToken">The cancellation token.</param>
long UpdateMany<TDocument, TKey>(FilterDefinition<TDocument> filter, UpdateDefinition<TDocument> updateDefinition, CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// For the entities selected by the filter, applies the update you have defined in MongoDb.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <param name="filter">The document filter.</param>
/// <param name="updateDefinition">The update definition to apply.</param>
/// <param name="partitionKey">The value of the partition key.</param>
long UpdateMany<TDocument, TKey>(FilterDefinition<TDocument> filter, UpdateDefinition<TDocument> updateDefinition, string partitionKey)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// For the entities selected by the filter, applies the update you have defined in MongoDb.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <param name="filter">The document filter.</param>
/// <param name="updateDefinition">The update definition to apply.</param>
/// <param name="partitionKey">The value of the partition key.</param>
/// <param name="cancellationToken">The cancellation token.</param>
long UpdateMany<TDocument, TKey>(FilterDefinition<TDocument> filter, UpdateDefinition<TDocument> updateDefinition, string partitionKey, CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
} }
} }
@@ -8,13 +8,12 @@ using MongoDbGenericRepository.Models;
namespace MongoDbGenericRepository.DataAccess.Update namespace MongoDbGenericRepository.DataAccess.Update
{ {
/// <summary> /// <summary>
/// The IBaseMongoRepository_Update_ClientSession interface exposing update functionality with a IClientSessionHandle. /// The IBaseMongoRepository_Update_ClientSession interface exposing update functionality with a IClientSessionHandle.
/// </summary> /// </summary>
public interface IBaseMongoRepository_Update_ClientSession public interface IBaseMongoRepository_Update_ClientSession
{ {
/// <summary> /// <summary>
/// Updates a document. /// Updates a document.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -24,12 +23,16 @@ namespace MongoDbGenericRepository.DataAccess.Update
/// <param name="field">The field to update.</param> /// <param name="field">The field to update.</param>
/// <param name="value">The value of the field.</param> /// <param name="value">The value of the field.</param>
/// <returns>A boolean value indicating success.</returns> /// <returns>A boolean value indicating success.</returns>
bool UpdateOne<TDocument, TKey, TField>(IClientSessionHandle session, Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value) bool UpdateOne<TDocument, TKey, TField>(
IClientSessionHandle session,
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TField>> field,
TField value)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Updates a document. /// Updates a document.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -40,12 +43,17 @@ namespace MongoDbGenericRepository.DataAccess.Update
/// <param name="value">The value of the field.</param> /// <param name="value">The value of the field.</param>
/// <param name="cancellationToken">The optional cancellation token.</param> /// <param name="cancellationToken">The optional cancellation token.</param>
/// <returns>A boolean value indicating success.</returns> /// <returns>A boolean value indicating success.</returns>
bool UpdateOne<TDocument, TKey, TField>(IClientSessionHandle session, Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, CancellationToken cancellationToken) bool UpdateOne<TDocument, TKey, TField>(
IClientSessionHandle session,
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TField>> field,
TField value,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Updates a document. /// Updates a document.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -56,12 +64,17 @@ namespace MongoDbGenericRepository.DataAccess.Update
/// <param name="value">The value of the field.</param> /// <param name="value">The value of the field.</param>
/// <param name="partitionKey">The optional partition key.</param> /// <param name="partitionKey">The optional partition key.</param>
/// <returns>A boolean value indicating success.</returns> /// <returns>A boolean value indicating success.</returns>
bool UpdateOne<TDocument, TKey, TField>(IClientSessionHandle session, Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey) bool UpdateOne<TDocument, TKey, TField>(
IClientSessionHandle session,
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TField>> field,
TField value,
string partitionKey)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Updates a document. /// Updates a document.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -73,12 +86,18 @@ namespace MongoDbGenericRepository.DataAccess.Update
/// <param name="partitionKey">The optional partition key.</param> /// <param name="partitionKey">The optional partition key.</param>
/// <param name="cancellationToken">The optional cancellation token.</param> /// <param name="cancellationToken">The optional cancellation token.</param>
/// <returns>A boolean value indicating success.</returns> /// <returns>A boolean value indicating success.</returns>
bool UpdateOne<TDocument, TKey, TField>(IClientSessionHandle session, Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey, CancellationToken cancellationToken) bool UpdateOne<TDocument, TKey, TField>(
IClientSessionHandle session,
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TField>> field,
TField value,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Updates a document. /// Updates a document.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -88,12 +107,16 @@ namespace MongoDbGenericRepository.DataAccess.Update
/// <param name="field">The field to update.</param> /// <param name="field">The field to update.</param>
/// <param name="value">The value of the field.</param> /// <param name="value">The value of the field.</param>
/// <returns>A boolean value indicating success.</returns> /// <returns>A boolean value indicating success.</returns>
bool UpdateOne<TDocument, TKey, TField>(IClientSessionHandle session, FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value) bool UpdateOne<TDocument, TKey, TField>(
IClientSessionHandle session,
FilterDefinition<TDocument> filter,
Expression<Func<TDocument, TField>> field,
TField value)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Updates a document. /// Updates a document.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -104,12 +127,17 @@ namespace MongoDbGenericRepository.DataAccess.Update
/// <param name="value">The value of the field.</param> /// <param name="value">The value of the field.</param>
/// <param name="cancellationToken">The optional cancellation token.</param> /// <param name="cancellationToken">The optional cancellation token.</param>
/// <returns>A boolean value indicating success.</returns> /// <returns>A boolean value indicating success.</returns>
bool UpdateOne<TDocument, TKey, TField>(IClientSessionHandle session, FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, CancellationToken cancellationToken) bool UpdateOne<TDocument, TKey, TField>(
IClientSessionHandle session,
FilterDefinition<TDocument> filter,
Expression<Func<TDocument, TField>> field,
TField value,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Updates a document. /// Updates a document.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -120,12 +148,17 @@ namespace MongoDbGenericRepository.DataAccess.Update
/// <param name="value">The value of the field.</param> /// <param name="value">The value of the field.</param>
/// <param name="partitionKey">The optional partition key.</param> /// <param name="partitionKey">The optional partition key.</param>
/// <returns>A boolean value indicating success.</returns> /// <returns>A boolean value indicating success.</returns>
bool UpdateOne<TDocument, TKey, TField>(IClientSessionHandle session, FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey) bool UpdateOne<TDocument, TKey, TField>(
IClientSessionHandle session,
FilterDefinition<TDocument> filter,
Expression<Func<TDocument, TField>> field,
TField value,
string partitionKey)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Updates a document. /// Updates a document.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -137,12 +170,18 @@ namespace MongoDbGenericRepository.DataAccess.Update
/// <param name="partitionKey">The optional partition key.</param> /// <param name="partitionKey">The optional partition key.</param>
/// <param name="cancellationToken">The optional cancellation token.</param> /// <param name="cancellationToken">The optional cancellation token.</param>
/// <returns>A boolean value indicating success.</returns> /// <returns>A boolean value indicating success.</returns>
bool UpdateOne<TDocument, TKey, TField>(IClientSessionHandle session, FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey, CancellationToken cancellationToken) bool UpdateOne<TDocument, TKey, TField>(
IClientSessionHandle session,
FilterDefinition<TDocument> filter,
Expression<Func<TDocument, TField>> field,
TField value,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Updates a document. /// Updates a document.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -152,12 +191,16 @@ namespace MongoDbGenericRepository.DataAccess.Update
/// <param name="field">The field to update.</param> /// <param name="field">The field to update.</param>
/// <param name="value">The value of the field.</param> /// <param name="value">The value of the field.</param>
/// <returns>A boolean value indicating success.</returns> /// <returns>A boolean value indicating success.</returns>
bool UpdateOne<TDocument, TKey, TField>(IClientSessionHandle session, TDocument documentToModify, Expression<Func<TDocument, TField>> field, TField value) bool UpdateOne<TDocument, TKey, TField>(
IClientSessionHandle session,
TDocument documentToModify,
Expression<Func<TDocument, TField>> field,
TField value)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Updates a document. /// Updates a document.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -168,12 +211,17 @@ namespace MongoDbGenericRepository.DataAccess.Update
/// <param name="value">The value of the field.</param> /// <param name="value">The value of the field.</param>
/// <param name="cancellationToken">The optional cancellation token.</param> /// <param name="cancellationToken">The optional cancellation token.</param>
/// <returns>A boolean value indicating success.</returns> /// <returns>A boolean value indicating success.</returns>
bool UpdateOne<TDocument, TKey, TField>(IClientSessionHandle session, TDocument documentToModify, Expression<Func<TDocument, TField>> field, TField value, CancellationToken cancellationToken) bool UpdateOne<TDocument, TKey, TField>(
IClientSessionHandle session,
TDocument documentToModify,
Expression<Func<TDocument, TField>> field,
TField value,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Updates a document. /// Updates a document.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -185,7 +233,7 @@ namespace MongoDbGenericRepository.DataAccess.Update
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Updates a document. /// Updates a document.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -198,7 +246,7 @@ namespace MongoDbGenericRepository.DataAccess.Update
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Updates a document. /// Updates a document.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -211,7 +259,7 @@ namespace MongoDbGenericRepository.DataAccess.Update
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Updates a document. /// Updates a document.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -220,12 +268,16 @@ namespace MongoDbGenericRepository.DataAccess.Update
/// <param name="update">The update definition.</param> /// <param name="update">The update definition.</param>
/// <param name="cancellationToken">The optional cancellation token.</param> /// <param name="cancellationToken">The optional cancellation token.</param>
/// <returns>A boolean value indicating success.</returns> /// <returns>A boolean value indicating success.</returns>
bool UpdateOne<TDocument, TKey>(IClientSessionHandle session, TDocument documentToModify, UpdateDefinition<TDocument> update, CancellationToken cancellationToken) bool UpdateOne<TDocument, TKey>(
IClientSessionHandle session,
TDocument documentToModify,
UpdateDefinition<TDocument> update,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Updates a document. /// Updates a document.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -235,12 +287,16 @@ namespace MongoDbGenericRepository.DataAccess.Update
/// <param name="field">The field to update.</param> /// <param name="field">The field to update.</param>
/// <param name="value">The value of the field.</param> /// <param name="value">The value of the field.</param>
/// <returns>A boolean value indicating success.</returns> /// <returns>A boolean value indicating success.</returns>
Task<bool> UpdateOneAsync<TDocument, TKey, TField>(IClientSessionHandle session, Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value) Task<bool> UpdateOneAsync<TDocument, TKey, TField>(
IClientSessionHandle session,
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TField>> field,
TField value)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Updates a document. /// Updates a document.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -251,12 +307,17 @@ namespace MongoDbGenericRepository.DataAccess.Update
/// <param name="value">The value of the field.</param> /// <param name="value">The value of the field.</param>
/// <param name="cancellationToken">The optional cancellation token.</param> /// <param name="cancellationToken">The optional cancellation token.</param>
/// <returns>A boolean value indicating success.</returns> /// <returns>A boolean value indicating success.</returns>
Task<bool> UpdateOneAsync<TDocument, TKey, TField>(IClientSessionHandle session, Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, CancellationToken cancellationToken) Task<bool> UpdateOneAsync<TDocument, TKey, TField>(
IClientSessionHandle session,
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TField>> field,
TField value,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Updates a document. /// Updates a document.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -267,12 +328,17 @@ namespace MongoDbGenericRepository.DataAccess.Update
/// <param name="value">The value of the field.</param> /// <param name="value">The value of the field.</param>
/// <param name="partitionKey">The optional partition key.</param> /// <param name="partitionKey">The optional partition key.</param>
/// <returns>A boolean value indicating success.</returns> /// <returns>A boolean value indicating success.</returns>
Task<bool> UpdateOneAsync<TDocument, TKey, TField>(IClientSessionHandle session, Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey) Task<bool> UpdateOneAsync<TDocument, TKey, TField>(
IClientSessionHandle session,
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TField>> field,
TField value,
string partitionKey)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Updates a document. /// Updates a document.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -284,12 +350,18 @@ namespace MongoDbGenericRepository.DataAccess.Update
/// <param name="partitionKey">The optional partition key.</param> /// <param name="partitionKey">The optional partition key.</param>
/// <param name="cancellationToken">The optional cancellation token.</param> /// <param name="cancellationToken">The optional cancellation token.</param>
/// <returns>A boolean value indicating success.</returns> /// <returns>A boolean value indicating success.</returns>
Task<bool> UpdateOneAsync<TDocument, TKey, TField>(IClientSessionHandle session, Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey, CancellationToken cancellationToken) Task<bool> UpdateOneAsync<TDocument, TKey, TField>(
IClientSessionHandle session,
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TField>> field,
TField value,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Updates a document. /// Updates a document.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -299,12 +371,16 @@ namespace MongoDbGenericRepository.DataAccess.Update
/// <param name="field">The field to update.</param> /// <param name="field">The field to update.</param>
/// <param name="value">The value of the field.</param> /// <param name="value">The value of the field.</param>
/// <returns></returns> /// <returns></returns>
Task<bool> UpdateOneAsync<TDocument, TKey, TField>(IClientSessionHandle session, FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value) Task<bool> UpdateOneAsync<TDocument, TKey, TField>(
IClientSessionHandle session,
FilterDefinition<TDocument> filter,
Expression<Func<TDocument, TField>> field,
TField value)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Updates a document. /// Updates a document.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -315,12 +391,17 @@ namespace MongoDbGenericRepository.DataAccess.Update
/// <param name="value">The value of the field.</param> /// <param name="value">The value of the field.</param>
/// <param name="cancellationToken">The optional cancellation token.</param> /// <param name="cancellationToken">The optional cancellation token.</param>
/// <returns></returns> /// <returns></returns>
Task<bool> UpdateOneAsync<TDocument, TKey, TField>(IClientSessionHandle session, FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, CancellationToken cancellationToken) Task<bool> UpdateOneAsync<TDocument, TKey, TField>(
IClientSessionHandle session,
FilterDefinition<TDocument> filter,
Expression<Func<TDocument, TField>> field,
TField value,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Updates a document. /// Updates a document.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -331,12 +412,17 @@ namespace MongoDbGenericRepository.DataAccess.Update
/// <param name="value">The value of the field.</param> /// <param name="value">The value of the field.</param>
/// <param name="partitionKey">The optional partition key.</param> /// <param name="partitionKey">The optional partition key.</param>
/// <returns></returns> /// <returns></returns>
Task<bool> UpdateOneAsync<TDocument, TKey, TField>(IClientSessionHandle session, FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey) Task<bool> UpdateOneAsync<TDocument, TKey, TField>(
IClientSessionHandle session,
FilterDefinition<TDocument> filter,
Expression<Func<TDocument, TField>> field,
TField value,
string partitionKey)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Updates a document. /// Updates a document.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -348,12 +434,18 @@ namespace MongoDbGenericRepository.DataAccess.Update
/// <param name="partitionKey">The optional partition key.</param> /// <param name="partitionKey">The optional partition key.</param>
/// <param name="cancellationToken">The optional cancellation token.</param> /// <param name="cancellationToken">The optional cancellation token.</param>
/// <returns></returns> /// <returns></returns>
Task<bool> UpdateOneAsync<TDocument, TKey, TField>(IClientSessionHandle session, FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey, CancellationToken cancellationToken) Task<bool> UpdateOneAsync<TDocument, TKey, TField>(
IClientSessionHandle session,
FilterDefinition<TDocument> filter,
Expression<Func<TDocument, TField>> field,
TField value,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Updates a document. /// Updates a document.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -363,12 +455,16 @@ namespace MongoDbGenericRepository.DataAccess.Update
/// <param name="field">The field to update.</param> /// <param name="field">The field to update.</param>
/// <param name="value">The value of the field.</param> /// <param name="value">The value of the field.</param>
/// <returns>A boolean value indicating success.</returns> /// <returns>A boolean value indicating success.</returns>
Task<bool> UpdateOneAsync<TDocument, TKey, TField>(IClientSessionHandle session, TDocument documentToModify, Expression<Func<TDocument, TField>> field, TField value) Task<bool> UpdateOneAsync<TDocument, TKey, TField>(
IClientSessionHandle session,
TDocument documentToModify,
Expression<Func<TDocument, TField>> field,
TField value)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Updates a document. /// Updates a document.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -379,12 +475,17 @@ namespace MongoDbGenericRepository.DataAccess.Update
/// <param name="value">The value of the field.</param> /// <param name="value">The value of the field.</param>
/// <param name="cancellationToken">The optional cancellation token.</param> /// <param name="cancellationToken">The optional cancellation token.</param>
/// <returns>A boolean value indicating success.</returns> /// <returns>A boolean value indicating success.</returns>
Task<bool> UpdateOneAsync<TDocument, TKey, TField>(IClientSessionHandle session, TDocument documentToModify, Expression<Func<TDocument, TField>> field, TField value, CancellationToken cancellationToken) Task<bool> UpdateOneAsync<TDocument, TKey, TField>(
IClientSessionHandle session,
TDocument documentToModify,
Expression<Func<TDocument, TField>> field,
TField value,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Updates a document. /// Updates a document.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -396,7 +497,7 @@ namespace MongoDbGenericRepository.DataAccess.Update
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Updates a document. /// Updates a document.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -409,7 +510,7 @@ namespace MongoDbGenericRepository.DataAccess.Update
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Updates a document. /// Updates a document.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -422,7 +523,7 @@ namespace MongoDbGenericRepository.DataAccess.Update
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Updates a document. /// Updates a document.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -431,7 +532,11 @@ namespace MongoDbGenericRepository.DataAccess.Update
/// <param name="update">The update definition.</param> /// <param name="update">The update definition.</param>
/// <param name="cancellationToken">The optional cancellation token.</param> /// <param name="cancellationToken">The optional cancellation token.</param>
/// <returns>A boolean value indicating success.</returns> /// <returns>A boolean value indicating success.</returns>
Task<bool> UpdateOneAsync<TDocument, TKey>(IClientSessionHandle session, TDocument documentToModify, UpdateDefinition<TDocument> update, CancellationToken cancellationToken) Task<bool> UpdateOneAsync<TDocument, TKey>(
IClientSessionHandle session,
TDocument documentToModify,
UpdateDefinition<TDocument> update,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
} }
@@ -2,10 +2,10 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Linq.Expressions; using System.Linq.Expressions;
using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using MongoDB.Driver; using MongoDB.Driver;
using MongoDbGenericRepository.Models; using MongoDbGenericRepository.Models;
using CancellationToken = System.Threading.CancellationToken;
namespace MongoDbGenericRepository namespace MongoDbGenericRepository
{ {
@@ -488,7 +488,11 @@ namespace MongoDbGenericRepository
/// <param name="countOption">A mongodb counting option.</param> /// <param name="countOption">A mongodb counting option.</param>
/// <param name="partitionKey">An optional partition key.</param> /// <param name="partitionKey">An optional partition key.</param>
/// <param name="cancellationToken">An optional cancellation Token.</param> /// <param name="cancellationToken">An optional cancellation Token.</param>
Task<bool> AnyAsync<TDocument, TKey>(FilterDefinition<TDocument> condition, CountOptions countOption, string partitionKey, CancellationToken cancellationToken) Task<bool> AnyAsync<TDocument, TKey>(
FilterDefinition<TDocument> condition,
CountOptions countOption,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
@@ -760,7 +764,11 @@ namespace MongoDbGenericRepository
/// <param name="findOption">A mongodb filter option.</param> /// <param name="findOption">A mongodb filter option.</param>
/// <param name="partitionKey">An optional partition key.</param> /// <param name="partitionKey">An optional partition key.</param>
/// <param name="cancellationToken">An optional cancellation Token.</param> /// <param name="cancellationToken">An optional cancellation Token.</param>
Task<List<TDocument>> GetAllAsync<TDocument, TKey>(FilterDefinition<TDocument> condition, FindOptions findOption, string partitionKey, CancellationToken cancellationToken) Task<List<TDocument>> GetAllAsync<TDocument, TKey>(
FilterDefinition<TDocument> condition,
FindOptions findOption,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
@@ -852,7 +860,11 @@ namespace MongoDbGenericRepository
/// <param name="findOption">A mongodb filter option.</param> /// <param name="findOption">A mongodb filter option.</param>
/// <param name="partitionKey">An optional partition key.</param> /// <param name="partitionKey">An optional partition key.</param>
/// <param name="cancellationToken">An optional cancellation Token.</param> /// <param name="cancellationToken">An optional cancellation Token.</param>
List<TDocument> GetAll<TDocument, TKey>(FilterDefinition<TDocument> condition, FindOptions findOption, string partitionKey, CancellationToken cancellationToken) List<TDocument> GetAll<TDocument, TKey>(
FilterDefinition<TDocument> condition,
FindOptions findOption,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
@@ -1032,7 +1044,11 @@ namespace MongoDbGenericRepository
/// <param name="countOption">A mongodb counting option.</param> /// <param name="countOption">A mongodb counting option.</param>
/// <param name="partitionKey">An optional partitionKey</param> /// <param name="partitionKey">An optional partitionKey</param>
/// <param name="cancellationToken">An optional cancellation Token.</param> /// <param name="cancellationToken">An optional cancellation Token.</param>
Task<long> CountAsync<TDocument, TKey>(FilterDefinition<TDocument> condition, CountOptions countOption, string partitionKey, CancellationToken cancellationToken) Task<long> CountAsync<TDocument, TKey>(
FilterDefinition<TDocument> condition,
CountOptions countOption,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
@@ -1241,7 +1257,10 @@ namespace MongoDbGenericRepository
/// <param name="filter">A LINQ expression filter.</param> /// <param name="filter">A LINQ expression filter.</param>
/// <param name="maxValueSelector">A property selector to order by descending.</param> /// <param name="maxValueSelector">A property selector to order by descending.</param>
/// <param name="cancellationToken">An optional cancellation Token.</param> /// <param name="cancellationToken">An optional cancellation Token.</param>
Task<TDocument> GetByMaxAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, object>> maxValueSelector, CancellationToken cancellationToken) Task<TDocument> GetByMaxAsync<TDocument, TKey>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, object>> maxValueSelector,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
@@ -1255,7 +1274,10 @@ namespace MongoDbGenericRepository
/// <param name="filter">A LINQ expression filter.</param> /// <param name="filter">A LINQ expression filter.</param>
/// <param name="maxValueSelector">A property selector to order by descending.</param> /// <param name="maxValueSelector">A property selector to order by descending.</param>
/// <param name="partitionKey">An optional partitionKey.</param> /// <param name="partitionKey">An optional partitionKey.</param>
Task<TDocument> GetByMaxAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, object>> maxValueSelector, string partitionKey) Task<TDocument> GetByMaxAsync<TDocument, TKey>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, object>> maxValueSelector,
string partitionKey)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
@@ -1269,7 +1291,11 @@ namespace MongoDbGenericRepository
/// <param name="maxValueSelector">A property selector to order by descending.</param> /// <param name="maxValueSelector">A property selector to order by descending.</param>
/// <param name="partitionKey">An optional partitionKey.</param> /// <param name="partitionKey">An optional partitionKey.</param>
/// <param name="cancellationToken">An optional cancellation Token.</param> /// <param name="cancellationToken">An optional cancellation Token.</param>
Task<TDocument> GetByMaxAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, object>> maxValueSelector, string partitionKey, CancellationToken cancellationToken) Task<TDocument> GetByMaxAsync<TDocument, TKey>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, object>> maxValueSelector,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
@@ -1294,7 +1320,10 @@ namespace MongoDbGenericRepository
/// <param name="filter">A LINQ expression filter.</param> /// <param name="filter">A LINQ expression filter.</param>
/// <param name="orderByDescending">A property selector to order by descending.</param> /// <param name="orderByDescending">A property selector to order by descending.</param>
/// <param name="cancellationToken">An optional cancellation token.</param> /// <param name="cancellationToken">An optional cancellation token.</param>
TDocument GetByMax<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, object>> orderByDescending, CancellationToken cancellationToken) TDocument GetByMax<TDocument, TKey>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, object>> orderByDescending,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
@@ -1307,7 +1336,10 @@ namespace MongoDbGenericRepository
/// <param name="filter">A LINQ expression filter.</param> /// <param name="filter">A LINQ expression filter.</param>
/// <param name="orderByDescending">A property selector to order by descending.</param> /// <param name="orderByDescending">A property selector to order by descending.</param>
/// <param name="partitionKey">An optional partitionKey.</param> /// <param name="partitionKey">An optional partitionKey.</param>
TDocument GetByMax<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, object>> orderByDescending, string partitionKey) TDocument GetByMax<TDocument, TKey>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, object>> orderByDescending,
string partitionKey)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
@@ -1321,7 +1353,11 @@ namespace MongoDbGenericRepository
/// <param name="orderByDescending">A property selector to order by descending.</param> /// <param name="orderByDescending">A property selector to order by descending.</param>
/// <param name="partitionKey">An optional partitionKey.</param> /// <param name="partitionKey">An optional partitionKey.</param>
/// <param name="cancellationToken">An optional cancellation token.</param> /// <param name="cancellationToken">An optional cancellation token.</param>
TDocument GetByMax<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, object>> orderByDescending, string partitionKey, CancellationToken cancellationToken) TDocument GetByMax<TDocument, TKey>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, object>> orderByDescending,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
@@ -1346,7 +1382,10 @@ namespace MongoDbGenericRepository
/// <param name="filter">A LINQ expression filter.</param> /// <param name="filter">A LINQ expression filter.</param>
/// <param name="minValueSelector">A property selector for the minimum value you are looking for.</param> /// <param name="minValueSelector">A property selector for the minimum value you are looking for.</param>
/// <param name="cancellationToken">An optional cancellation Token.</param> /// <param name="cancellationToken">An optional cancellation Token.</param>
Task<TDocument> GetByMinAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, object>> minValueSelector, CancellationToken cancellationToken) Task<TDocument> GetByMinAsync<TDocument, TKey>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, object>> minValueSelector,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
@@ -1359,7 +1398,10 @@ namespace MongoDbGenericRepository
/// <param name="filter">A LINQ expression filter.</param> /// <param name="filter">A LINQ expression filter.</param>
/// <param name="minValueSelector">A property selector for the minimum value you are looking for.</param> /// <param name="minValueSelector">A property selector for the minimum value you are looking for.</param>
/// <param name="partitionKey">An optional partitionKey.</param> /// <param name="partitionKey">An optional partitionKey.</param>
Task<TDocument> GetByMinAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, object>> minValueSelector, string partitionKey) Task<TDocument> GetByMinAsync<TDocument, TKey>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, object>> minValueSelector,
string partitionKey)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
@@ -1373,7 +1415,11 @@ namespace MongoDbGenericRepository
/// <param name="minValueSelector">A property selector for the minimum value you are looking for.</param> /// <param name="minValueSelector">A property selector for the minimum value you are looking for.</param>
/// <param name="partitionKey">An optional partitionKey.</param> /// <param name="partitionKey">An optional partitionKey.</param>
/// <param name="cancellationToken">An optional cancellation token.</param> /// <param name="cancellationToken">An optional cancellation token.</param>
Task<TDocument> GetByMinAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, object>> minValueSelector, string partitionKey, CancellationToken cancellationToken) Task<TDocument> GetByMinAsync<TDocument, TKey>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, object>> minValueSelector,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
@@ -1398,7 +1444,10 @@ namespace MongoDbGenericRepository
/// <param name="filter">A LINQ expression filter.</param> /// <param name="filter">A LINQ expression filter.</param>
/// <param name="minValueSelector">A property selector for the minimum value you are looking for.</param> /// <param name="minValueSelector">A property selector for the minimum value you are looking for.</param>
/// <param name="cancellationToken">An optional cancellation token.</param> /// <param name="cancellationToken">An optional cancellation token.</param>
TDocument GetByMin<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, object>> minValueSelector, CancellationToken cancellationToken) TDocument GetByMin<TDocument, TKey>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, object>> minValueSelector,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
@@ -1425,7 +1474,11 @@ namespace MongoDbGenericRepository
/// <param name="minValueSelector">A property selector for the minimum value you are looking for.</param> /// <param name="minValueSelector">A property selector for the minimum value you are looking for.</param>
/// <param name="partitionKey">An optional partitionKey.</param> /// <param name="partitionKey">An optional partitionKey.</param>
/// <param name="cancellationToken">An optional cancellation token.</param> /// <param name="cancellationToken">An optional cancellation token.</param>
TDocument GetByMin<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, object>> minValueSelector, string partitionKey, CancellationToken cancellationToken) TDocument GetByMin<TDocument, TKey>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, object>> minValueSelector,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
@@ -1450,7 +1503,10 @@ namespace MongoDbGenericRepository
/// <param name="filter">A LINQ expression filter.</param> /// <param name="filter">A LINQ expression filter.</param>
/// <param name="maxValueSelector">A property selector for the maximum value you are looking for.</param> /// <param name="maxValueSelector">A property selector for the maximum value you are looking for.</param>
/// <param name="cancellationToken">An optional cancellation Token.</param> /// <param name="cancellationToken">An optional cancellation Token.</param>
Task<TValue> GetMaxValueAsync<TDocument, TKey, TValue>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TValue>> maxValueSelector, CancellationToken cancellationToken) Task<TValue> GetMaxValueAsync<TDocument, TKey, TValue>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TValue>> maxValueSelector,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
@@ -1463,7 +1519,10 @@ namespace MongoDbGenericRepository
/// <param name="filter">A LINQ expression filter.</param> /// <param name="filter">A LINQ expression filter.</param>
/// <param name="maxValueSelector">A property selector for the maximum value you are looking for.</param> /// <param name="maxValueSelector">A property selector for the maximum value you are looking for.</param>
/// <param name="partitionKey">An optional partitionKey.</param> /// <param name="partitionKey">An optional partitionKey.</param>
Task<TValue> GetMaxValueAsync<TDocument, TKey, TValue>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TValue>> maxValueSelector, string partitionKey) Task<TValue> GetMaxValueAsync<TDocument, TKey, TValue>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TValue>> maxValueSelector,
string partitionKey)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
@@ -1477,7 +1536,11 @@ namespace MongoDbGenericRepository
/// <param name="maxValueSelector">A property selector for the maximum value you are looking for.</param> /// <param name="maxValueSelector">A property selector for the maximum value you are looking for.</param>
/// <param name="partitionKey">An optional partitionKey.</param> /// <param name="partitionKey">An optional partitionKey.</param>
/// <param name="cancellationToken">An optional cancellation token.</param> /// <param name="cancellationToken">An optional cancellation token.</param>
Task<TValue> GetMaxValueAsync<TDocument, TKey, TValue>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TValue>> maxValueSelector, string partitionKey, CancellationToken cancellationToken) Task<TValue> GetMaxValueAsync<TDocument, TKey, TValue>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TValue>> maxValueSelector,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
@@ -1502,7 +1565,10 @@ namespace MongoDbGenericRepository
/// <param name="filter">A LINQ expression filter.</param> /// <param name="filter">A LINQ expression filter.</param>
/// <param name="maxValueSelector">A property selector to order by ascending.</param> /// <param name="maxValueSelector">A property selector to order by ascending.</param>
/// <param name="cancellationToken">An optional cancellation token.</param> /// <param name="cancellationToken">An optional cancellation token.</param>
TValue GetMaxValue<TDocument, TKey, TValue>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TValue>> maxValueSelector, CancellationToken cancellationToken) TValue GetMaxValue<TDocument, TKey, TValue>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TValue>> maxValueSelector,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
@@ -1515,7 +1581,10 @@ namespace MongoDbGenericRepository
/// <param name="filter">A LINQ expression filter.</param> /// <param name="filter">A LINQ expression filter.</param>
/// <param name="maxValueSelector">A property selector to order by ascending.</param> /// <param name="maxValueSelector">A property selector to order by ascending.</param>
/// <param name="partitionKey">An optional partitionKey.</param> /// <param name="partitionKey">An optional partitionKey.</param>
TValue GetMaxValue<TDocument, TKey, TValue>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TValue>> maxValueSelector, string partitionKey) TValue GetMaxValue<TDocument, TKey, TValue>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TValue>> maxValueSelector,
string partitionKey)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
@@ -1529,7 +1598,11 @@ namespace MongoDbGenericRepository
/// <param name="maxValueSelector">A property selector to order by ascending.</param> /// <param name="maxValueSelector">A property selector to order by ascending.</param>
/// <param name="partitionKey">An optional partitionKey.</param> /// <param name="partitionKey">An optional partitionKey.</param>
/// <param name="cancellationToken">An optional cancellation token.</param> /// <param name="cancellationToken">An optional cancellation token.</param>
TValue GetMaxValue<TDocument, TKey, TValue>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TValue>> maxValueSelector, string partitionKey, CancellationToken cancellationToken) TValue GetMaxValue<TDocument, TKey, TValue>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TValue>> maxValueSelector,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
@@ -1554,7 +1627,10 @@ namespace MongoDbGenericRepository
/// <param name="filter">A LINQ expression filter.</param> /// <param name="filter">A LINQ expression filter.</param>
/// <param name="minValueSelector">A property selector to order by ascending.</param> /// <param name="minValueSelector">A property selector to order by ascending.</param>
/// <param name="cancellationToken">An optional cancellation Token.</param> /// <param name="cancellationToken">An optional cancellation Token.</param>
Task<TValue> GetMinValueAsync<TDocument, TKey, TValue>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TValue>> minValueSelector, CancellationToken cancellationToken) Task<TValue> GetMinValueAsync<TDocument, TKey, TValue>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TValue>> minValueSelector,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
@@ -1567,7 +1643,10 @@ namespace MongoDbGenericRepository
/// <param name="filter">A LINQ expression filter.</param> /// <param name="filter">A LINQ expression filter.</param>
/// <param name="minValueSelector">A property selector to order by ascending.</param> /// <param name="minValueSelector">A property selector to order by ascending.</param>
/// <param name="partitionKey">An optional partition key.</param> /// <param name="partitionKey">An optional partition key.</param>
Task<TValue> GetMinValueAsync<TDocument, TKey, TValue>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TValue>> minValueSelector, string partitionKey) Task<TValue> GetMinValueAsync<TDocument, TKey, TValue>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TValue>> minValueSelector,
string partitionKey)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
@@ -1581,7 +1660,11 @@ namespace MongoDbGenericRepository
/// <param name="minValueSelector">A property selector to order by ascending.</param> /// <param name="minValueSelector">A property selector to order by ascending.</param>
/// <param name="partitionKey">An optional partition key.</param> /// <param name="partitionKey">An optional partition key.</param>
/// <param name="cancellationToken">An optional cancellation token.</param> /// <param name="cancellationToken">An optional cancellation token.</param>
Task<TValue> GetMinValueAsync<TDocument, TKey, TValue>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TValue>> minValueSelector, string partitionKey, CancellationToken cancellationToken) Task<TValue> GetMinValueAsync<TDocument, TKey, TValue>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TValue>> minValueSelector,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
@@ -1606,7 +1689,10 @@ namespace MongoDbGenericRepository
/// <param name="filter">A LINQ expression filter.</param> /// <param name="filter">A LINQ expression filter.</param>
/// <param name="minValueSelector">A property selector to order by ascending.</param> /// <param name="minValueSelector">A property selector to order by ascending.</param>
/// <param name="cancellationToken">An optional cancellation token.</param> /// <param name="cancellationToken">An optional cancellation token.</param>
TValue GetMinValue<TDocument, TKey, TValue>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TValue>> minValueSelector, CancellationToken cancellationToken) TValue GetMinValue<TDocument, TKey, TValue>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TValue>> minValueSelector,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
@@ -1619,7 +1705,10 @@ namespace MongoDbGenericRepository
/// <param name="filter">A LINQ expression filter.</param> /// <param name="filter">A LINQ expression filter.</param>
/// <param name="minValueSelector">A property selector to order by ascending.</param> /// <param name="minValueSelector">A property selector to order by ascending.</param>
/// <param name="partitionKey">An optional partition key.</param> /// <param name="partitionKey">An optional partition key.</param>
TValue GetMinValue<TDocument, TKey, TValue>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TValue>> minValueSelector, string partitionKey) TValue GetMinValue<TDocument, TKey, TValue>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TValue>> minValueSelector,
string partitionKey)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
@@ -1633,7 +1722,11 @@ namespace MongoDbGenericRepository
/// <param name="minValueSelector">A property selector to order by ascending.</param> /// <param name="minValueSelector">A property selector to order by ascending.</param>
/// <param name="partitionKey">An optional partition key.</param> /// <param name="partitionKey">An optional partition key.</param>
/// <param name="cancellationToken">An optional cancellation token.</param> /// <param name="cancellationToken">An optional cancellation token.</param>
TValue GetMinValue<TDocument, TKey, TValue>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TValue>> minValueSelector, string partitionKey, CancellationToken cancellationToken) TValue GetMinValue<TDocument, TKey, TValue>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TValue>> minValueSelector,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
@@ -1660,7 +1753,10 @@ namespace MongoDbGenericRepository
/// <param name="filter">A LINQ expression filter.</param> /// <param name="filter">A LINQ expression filter.</param>
/// <param name="selector">The field you want to sum.</param> /// <param name="selector">The field you want to sum.</param>
/// <param name="cancellationToken">An optional cancellation Token.</param> /// <param name="cancellationToken">An optional cancellation Token.</param>
Task<int> SumByAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, int>> selector, CancellationToken cancellationToken) Task<int> SumByAsync<TDocument, TKey>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, int>> selector,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
@@ -1685,7 +1781,11 @@ namespace MongoDbGenericRepository
/// <param name="selector">The field you want to sum.</param> /// <param name="selector">The field you want to sum.</param>
/// <param name="partitionKey">The partition key of your document, if any.</param> /// <param name="partitionKey">The partition key of your document, if any.</param>
/// <param name="cancellationToken">An optional cancellation token.</param> /// <param name="cancellationToken">An optional cancellation token.</param>
Task<int> SumByAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, int>> selector, string partitionKey, CancellationToken cancellationToken) Task<int> SumByAsync<TDocument, TKey>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, int>> selector,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
@@ -1720,7 +1820,10 @@ namespace MongoDbGenericRepository
/// <param name="filter">A LINQ expression filter.</param> /// <param name="filter">A LINQ expression filter.</param>
/// <param name="selector">The field you want to sum.</param> /// <param name="selector">The field you want to sum.</param>
/// <param name="cancellationToken">An optional cancellation token.</param> /// <param name="cancellationToken">An optional cancellation token.</param>
Task<decimal> SumByAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, decimal>> selector, CancellationToken cancellationToken) Task<decimal> SumByAsync<TDocument, TKey>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, decimal>> selector,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
@@ -1745,7 +1848,11 @@ namespace MongoDbGenericRepository
/// <param name="selector">The field you want to sum.</param> /// <param name="selector">The field you want to sum.</param>
/// <param name="partitionKey">The partition key of your document, if any.</param> /// <param name="partitionKey">The partition key of your document, if any.</param>
/// <param name="cancellationToken">An optional cancellation token.</param> /// <param name="cancellationToken">An optional cancellation token.</param>
Task<decimal> SumByAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, decimal>> selector, string partitionKey, CancellationToken cancellationToken) Task<decimal> SumByAsync<TDocument, TKey>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, decimal>> selector,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
@@ -1776,7 +1883,9 @@ namespace MongoDbGenericRepository
/// <typeparam name="TProjection">The type representing the model you want to project to.</typeparam> /// <typeparam name="TProjection">The type representing the model you want to project to.</typeparam>
/// <param name="filter">A LINQ expression filter.</param> /// <param name="filter">A LINQ expression filter.</param>
/// <param name="projection">The projection expression.</param> /// <param name="projection">The projection expression.</param>
Task<TProjection> ProjectOneAsync<TDocument, TProjection, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TProjection>> projection) Task<TProjection> ProjectOneAsync<TDocument, TProjection, TKey>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TProjection>> projection)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey> where TKey : IEquatable<TKey>
where TProjection : class; where TProjection : class;
@@ -1790,7 +1899,10 @@ namespace MongoDbGenericRepository
/// <param name="filter">A LINQ expression filter.</param> /// <param name="filter">A LINQ expression filter.</param>
/// <param name="projection">The projection expression.</param> /// <param name="projection">The projection expression.</param>
/// <param name="cancellationToken">An optional cancellation Token.</param> /// <param name="cancellationToken">An optional cancellation Token.</param>
Task<TProjection> ProjectOneAsync<TDocument, TProjection, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TProjection>> projection, CancellationToken cancellationToken) Task<TProjection> ProjectOneAsync<TDocument, TProjection, TKey>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TProjection>> projection,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey> where TKey : IEquatable<TKey>
where TProjection : class; where TProjection : class;
@@ -1804,7 +1916,10 @@ namespace MongoDbGenericRepository
/// <param name="filter">A LINQ expression filter.</param> /// <param name="filter">A LINQ expression filter.</param>
/// <param name="projection">The projection expression.</param> /// <param name="projection">The projection expression.</param>
/// <param name="partitionKey">An optional partition key.</param> /// <param name="partitionKey">An optional partition key.</param>
Task<TProjection> ProjectOneAsync<TDocument, TProjection, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TProjection>> projection, string partitionKey) Task<TProjection> ProjectOneAsync<TDocument, TProjection, TKey>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TProjection>> projection,
string partitionKey)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey> where TKey : IEquatable<TKey>
where TProjection : class; where TProjection : class;
@@ -1819,7 +1934,11 @@ namespace MongoDbGenericRepository
/// <param name="projection">The projection expression.</param> /// <param name="projection">The projection expression.</param>
/// <param name="partitionKey">An optional partition key.</param> /// <param name="partitionKey">An optional partition key.</param>
/// <param name="cancellationToken">An optional cancellation token.</param> /// <param name="cancellationToken">An optional cancellation token.</param>
Task<TProjection> ProjectOneAsync<TDocument, TProjection, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TProjection>> projection, string partitionKey, CancellationToken cancellationToken) Task<TProjection> ProjectOneAsync<TDocument, TProjection, TKey>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TProjection>> projection,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey> where TKey : IEquatable<TKey>
where TProjection : class; where TProjection : class;
@@ -1846,7 +1965,10 @@ namespace MongoDbGenericRepository
/// <param name="filter"></param> /// <param name="filter"></param>
/// <param name="projection">The projection expression.</param> /// <param name="projection">The projection expression.</param>
/// <param name="cancellationToken">An optional cancellation token.</param> /// <param name="cancellationToken">An optional cancellation token.</param>
TProjection ProjectOne<TDocument, TProjection, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TProjection>> projection, CancellationToken cancellationToken) TProjection ProjectOne<TDocument, TProjection, TKey>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TProjection>> projection,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey> where TKey : IEquatable<TKey>
where TProjection : class; where TProjection : class;
@@ -1860,7 +1982,10 @@ namespace MongoDbGenericRepository
/// <param name="filter"></param> /// <param name="filter"></param>
/// <param name="projection">The projection expression.</param> /// <param name="projection">The projection expression.</param>
/// <param name="partitionKey">An optional partition key.</param> /// <param name="partitionKey">An optional partition key.</param>
TProjection ProjectOne<TDocument, TProjection, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TProjection>> projection, string partitionKey) TProjection ProjectOne<TDocument, TProjection, TKey>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TProjection>> projection,
string partitionKey)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey> where TKey : IEquatable<TKey>
where TProjection : class; where TProjection : class;
@@ -1875,7 +2000,11 @@ namespace MongoDbGenericRepository
/// <param name="projection">The projection expression.</param> /// <param name="projection">The projection expression.</param>
/// <param name="partitionKey">An optional partition key.</param> /// <param name="partitionKey">An optional partition key.</param>
/// <param name="cancellationToken">An optional cancellation token.</param> /// <param name="cancellationToken">An optional cancellation token.</param>
TProjection ProjectOne<TDocument, TProjection, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TProjection>> projection, string partitionKey, CancellationToken cancellationToken) TProjection ProjectOne<TDocument, TProjection, TKey>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TProjection>> projection,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey> where TKey : IEquatable<TKey>
where TProjection : class; where TProjection : class;
@@ -1888,7 +2017,9 @@ namespace MongoDbGenericRepository
/// <typeparam name="TProjection">The type representing the model you want to project to.</typeparam> /// <typeparam name="TProjection">The type representing the model you want to project to.</typeparam>
/// <param name="filter">A LINQ expression filter.</param> /// <param name="filter">A LINQ expression filter.</param>
/// <param name="projection">The projection expression.</param> /// <param name="projection">The projection expression.</param>
Task<List<TProjection>> ProjectManyAsync<TDocument, TProjection, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TProjection>> projection) Task<List<TProjection>> ProjectManyAsync<TDocument, TProjection, TKey>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TProjection>> projection)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey> where TKey : IEquatable<TKey>
where TProjection : class; where TProjection : class;
@@ -1902,7 +2033,10 @@ namespace MongoDbGenericRepository
/// <param name="filter">A LINQ expression filter.</param> /// <param name="filter">A LINQ expression filter.</param>
/// <param name="projection">The projection expression.</param> /// <param name="projection">The projection expression.</param>
/// <param name="cancellationToken">An optional cancellation Token.</param> /// <param name="cancellationToken">An optional cancellation Token.</param>
Task<List<TProjection>> ProjectManyAsync<TDocument, TProjection, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TProjection>> projection, CancellationToken cancellationToken) Task<List<TProjection>> ProjectManyAsync<TDocument, TProjection, TKey>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TProjection>> projection,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey> where TKey : IEquatable<TKey>
where TProjection : class; where TProjection : class;
@@ -1916,7 +2050,10 @@ namespace MongoDbGenericRepository
/// <param name="filter">A LINQ expression filter.</param> /// <param name="filter">A LINQ expression filter.</param>
/// <param name="projection">The projection expression.</param> /// <param name="projection">The projection expression.</param>
/// <param name="partitionKey">An optional partition key.</param> /// <param name="partitionKey">An optional partition key.</param>
Task<List<TProjection>> ProjectManyAsync<TDocument, TProjection, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TProjection>> projection, string partitionKey) Task<List<TProjection>> ProjectManyAsync<TDocument, TProjection, TKey>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TProjection>> projection,
string partitionKey)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey> where TKey : IEquatable<TKey>
where TProjection : class; where TProjection : class;
@@ -1931,7 +2068,11 @@ namespace MongoDbGenericRepository
/// <param name="projection">The projection expression.</param> /// <param name="projection">The projection expression.</param>
/// <param name="partitionKey">An optional partition key.</param> /// <param name="partitionKey">An optional partition key.</param>
/// <param name="cancellationToken">An optional cancellation token.</param> /// <param name="cancellationToken">An optional cancellation token.</param>
Task<List<TProjection>> ProjectManyAsync<TDocument, TProjection, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TProjection>> projection, string partitionKey, CancellationToken cancellationToken) Task<List<TProjection>> ProjectManyAsync<TDocument, TProjection, TKey>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TProjection>> projection,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey> where TKey : IEquatable<TKey>
where TProjection : class; where TProjection : class;
@@ -1944,7 +2085,9 @@ namespace MongoDbGenericRepository
/// <typeparam name="TProjection">The type representing the model you want to project to.</typeparam> /// <typeparam name="TProjection">The type representing the model you want to project to.</typeparam>
/// <param name="filter"></param> /// <param name="filter"></param>
/// <param name="projection">The projection expression.</param> /// <param name="projection">The projection expression.</param>
List<TProjection> ProjectMany<TDocument, TProjection, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TProjection>> projection) List<TProjection> ProjectMany<TDocument, TProjection, TKey>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TProjection>> projection)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey> where TKey : IEquatable<TKey>
where TProjection : class; where TProjection : class;
@@ -1958,7 +2101,10 @@ namespace MongoDbGenericRepository
/// <param name="filter"></param> /// <param name="filter"></param>
/// <param name="projection">The projection expression.</param> /// <param name="projection">The projection expression.</param>
/// <param name="cancellationToken">An optional cancellation token.</param> /// <param name="cancellationToken">An optional cancellation token.</param>
List<TProjection> ProjectMany<TDocument, TProjection, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TProjection>> projection, CancellationToken cancellationToken) List<TProjection> ProjectMany<TDocument, TProjection, TKey>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TProjection>> projection,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey> where TKey : IEquatable<TKey>
where TProjection : class; where TProjection : class;
@@ -1972,7 +2118,10 @@ namespace MongoDbGenericRepository
/// <param name="filter"></param> /// <param name="filter"></param>
/// <param name="projection">The projection expression.</param> /// <param name="projection">The projection expression.</param>
/// <param name="partitionKey">An optional partition key.</param> /// <param name="partitionKey">An optional partition key.</param>
List<TProjection> ProjectMany<TDocument, TProjection, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TProjection>> projection, string partitionKey) List<TProjection> ProjectMany<TDocument, TProjection, TKey>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TProjection>> projection,
string partitionKey)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey> where TKey : IEquatable<TKey>
where TProjection : class; where TProjection : class;
@@ -1987,7 +2136,11 @@ namespace MongoDbGenericRepository
/// <param name="projection">The projection expression.</param> /// <param name="projection">The projection expression.</param>
/// <param name="partitionKey">An optional partition key.</param> /// <param name="partitionKey">An optional partition key.</param>
/// <param name="cancellationToken">An optional cancellation token.</param> /// <param name="cancellationToken">An optional cancellation token.</param>
List<TProjection> ProjectMany<TDocument, TProjection, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TProjection>> projection, string partitionKey, CancellationToken cancellationToken) List<TProjection> ProjectMany<TDocument, TProjection, TKey>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TProjection>> projection,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey> where TKey : IEquatable<TKey>
where TProjection : class; where TProjection : class;
@@ -2006,7 +2159,9 @@ namespace MongoDbGenericRepository
/// <typeparam name="TKey">The type of the primary key.</typeparam> /// <typeparam name="TKey">The type of the primary key.</typeparam>
/// <param name="groupingCriteria">The grouping criteria.</param> /// <param name="groupingCriteria">The grouping criteria.</param>
/// <param name="groupProjection">The projected group result.</param> /// <param name="groupProjection">The projected group result.</param>
List<TProjection> GroupBy<TDocument, TGroupKey, TProjection, TKey>(Expression<Func<TDocument, TGroupKey>> groupingCriteria, Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection) List<TProjection> GroupBy<TDocument, TGroupKey, TProjection, TKey>(
Expression<Func<TDocument, TGroupKey>> groupingCriteria,
Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey> where TKey : IEquatable<TKey>
where TProjection : class, new(); where TProjection : class, new();
@@ -2022,7 +2177,10 @@ namespace MongoDbGenericRepository
/// <param name="groupingCriteria">The grouping criteria.</param> /// <param name="groupingCriteria">The grouping criteria.</param>
/// <param name="groupProjection">The projected group result.</param> /// <param name="groupProjection">The projected group result.</param>
/// <param name="cancellationToken">An optional cancellation token.</param> /// <param name="cancellationToken">An optional cancellation token.</param>
List<TProjection> GroupBy<TDocument, TGroupKey, TProjection, TKey>(Expression<Func<TDocument, TGroupKey>> groupingCriteria, Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection, CancellationToken cancellationToken) List<TProjection> GroupBy<TDocument, TGroupKey, TProjection, TKey>(
Expression<Func<TDocument, TGroupKey>> groupingCriteria,
Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey> where TKey : IEquatable<TKey>
where TProjection : class, new(); where TProjection : class, new();
@@ -2038,7 +2196,10 @@ namespace MongoDbGenericRepository
/// <param name="groupingCriteria">The grouping criteria.</param> /// <param name="groupingCriteria">The grouping criteria.</param>
/// <param name="groupProjection">The projected group result.</param> /// <param name="groupProjection">The projected group result.</param>
/// <param name="partitionKey">The partition key of your document, if any.</param> /// <param name="partitionKey">The partition key of your document, if any.</param>
List<TProjection> GroupBy<TDocument, TGroupKey, TProjection, TKey>(Expression<Func<TDocument, TGroupKey>> groupingCriteria, Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection, string partitionKey) List<TProjection> GroupBy<TDocument, TGroupKey, TProjection, TKey>(
Expression<Func<TDocument, TGroupKey>> groupingCriteria,
Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection,
string partitionKey)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey> where TKey : IEquatable<TKey>
where TProjection : class, new(); where TProjection : class, new();
@@ -2055,7 +2216,11 @@ namespace MongoDbGenericRepository
/// <param name="groupProjection">The projected group result.</param> /// <param name="groupProjection">The projected group result.</param>
/// <param name="partitionKey">The partition key of your document, if any.</param> /// <param name="partitionKey">The partition key of your document, if any.</param>
/// <param name="cancellationToken">An optional cancellation token.</param> /// <param name="cancellationToken">An optional cancellation token.</param>
List<TProjection> GroupBy<TDocument, TGroupKey, TProjection, TKey>(Expression<Func<TDocument, TGroupKey>> groupingCriteria, Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection, string partitionKey, CancellationToken cancellationToken) List<TProjection> GroupBy<TDocument, TGroupKey, TProjection, TKey>(
Expression<Func<TDocument, TGroupKey>> groupingCriteria,
Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey> where TKey : IEquatable<TKey>
where TProjection : class, new(); where TProjection : class, new();
@@ -2071,7 +2236,10 @@ namespace MongoDbGenericRepository
/// <param name="filter">A LINQ expression filter.</param> /// <param name="filter">A LINQ expression filter.</param>
/// <param name="groupingCriteria">The grouping criteria.</param> /// <param name="groupingCriteria">The grouping criteria.</param>
/// <param name="groupProjection">The projected group result.</param> /// <param name="groupProjection">The projected group result.</param>
List<TProjection> GroupBy<TDocument, TGroupKey, TProjection, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TGroupKey>> groupingCriteria, Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection) List<TProjection> GroupBy<TDocument, TGroupKey, TProjection, TKey>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TGroupKey>> groupingCriteria,
Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey> where TKey : IEquatable<TKey>
where TProjection : class, new(); where TProjection : class, new();
@@ -2088,7 +2256,11 @@ namespace MongoDbGenericRepository
/// <param name="groupingCriteria">The grouping criteria.</param> /// <param name="groupingCriteria">The grouping criteria.</param>
/// <param name="groupProjection">The projected group result.</param> /// <param name="groupProjection">The projected group result.</param>
/// <param name="cancellationToken">An optional cancellation token.</param> /// <param name="cancellationToken">An optional cancellation token.</param>
List<TProjection> GroupBy<TDocument, TGroupKey, TProjection, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TGroupKey>> groupingCriteria, Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection, CancellationToken cancellationToken) List<TProjection> GroupBy<TDocument, TGroupKey, TProjection, TKey>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TGroupKey>> groupingCriteria,
Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey> where TKey : IEquatable<TKey>
where TProjection : class, new(); where TProjection : class, new();
@@ -2105,7 +2277,11 @@ namespace MongoDbGenericRepository
/// <param name="groupingCriteria">The grouping criteria.</param> /// <param name="groupingCriteria">The grouping criteria.</param>
/// <param name="groupProjection">The projected group result.</param> /// <param name="groupProjection">The projected group result.</param>
/// <param name="partitionKey">The partition key of your document, if any.</param> /// <param name="partitionKey">The partition key of your document, if any.</param>
List<TProjection> GroupBy<TDocument, TGroupKey, TProjection, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TGroupKey>> groupingCriteria, Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection, string partitionKey) List<TProjection> GroupBy<TDocument, TGroupKey, TProjection, TKey>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TGroupKey>> groupingCriteria,
Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection,
string partitionKey)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey> where TKey : IEquatable<TKey>
where TProjection : class, new(); where TProjection : class, new();
@@ -2123,7 +2299,12 @@ namespace MongoDbGenericRepository
/// <param name="groupProjection">The projected group result.</param> /// <param name="groupProjection">The projected group result.</param>
/// <param name="partitionKey">The partition key of your document, if any.</param> /// <param name="partitionKey">The partition key of your document, if any.</param>
/// <param name="cancellationToken">An optional cancellation token.</param> /// <param name="cancellationToken">An optional cancellation token.</param>
List<TProjection> GroupBy<TDocument, TGroupKey, TProjection, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TGroupKey>> groupingCriteria, Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection, string partitionKey, CancellationToken cancellationToken) List<TProjection> GroupBy<TDocument, TGroupKey, TProjection, TKey>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TGroupKey>> groupingCriteria,
Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey> where TKey : IEquatable<TKey>
where TProjection : class, new(); where TProjection : class, new();
@@ -410,7 +410,10 @@ namespace MongoDbGenericRepository
/// <param name="filter">A LINQ expression filter.</param> /// <param name="filter">A LINQ expression filter.</param>
/// <param name="orderByDescending">A property selector to order by descending.</param> /// <param name="orderByDescending">A property selector to order by descending.</param>
/// <param name="cancellationToken">The cancellation token.</param> /// <param name="cancellationToken">The cancellation token.</param>
Task<TDocument> GetByMaxAsync<TDocument>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, object>> orderByDescending, CancellationToken cancellationToken) Task<TDocument> GetByMaxAsync<TDocument>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, object>> orderByDescending,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>; where TDocument : IDocument<TKey>;
/// <summary> /// <summary>
@@ -421,7 +424,10 @@ namespace MongoDbGenericRepository
/// <param name="filter">A LINQ expression filter.</param> /// <param name="filter">A LINQ expression filter.</param>
/// <param name="orderByDescending">A property selector to order by descending.</param> /// <param name="orderByDescending">A property selector to order by descending.</param>
/// <param name="partitionKey">An optional partitionKey.</param> /// <param name="partitionKey">An optional partitionKey.</param>
Task<TDocument> GetByMaxAsync<TDocument>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, object>> orderByDescending, string partitionKey) Task<TDocument> GetByMaxAsync<TDocument>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, object>> orderByDescending,
string partitionKey)
where TDocument : IDocument<TKey>; where TDocument : IDocument<TKey>;
/// <summary> /// <summary>
@@ -433,7 +439,11 @@ namespace MongoDbGenericRepository
/// <param name="orderByDescending">A property selector to order by descending.</param> /// <param name="orderByDescending">A property selector to order by descending.</param>
/// <param name="partitionKey">An optional partitionKey.</param> /// <param name="partitionKey">An optional partitionKey.</param>
/// <param name="cancellationToken">The cancellation token.</param> /// <param name="cancellationToken">The cancellation token.</param>
Task<TDocument> GetByMaxAsync<TDocument>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, object>> orderByDescending, string partitionKey, CancellationToken cancellationToken) Task<TDocument> GetByMaxAsync<TDocument>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, object>> orderByDescending,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>; where TDocument : IDocument<TKey>;
/// <summary> /// <summary>
@@ -456,7 +466,10 @@ namespace MongoDbGenericRepository
/// <param name="orderByDescending">A property selector to order by descending.</param> /// <param name="orderByDescending">A property selector to order by descending.</param>
/// <param name="cancellationToken">The cancellation token.</param> /// <param name="cancellationToken">The cancellation token.</param>
/// <returns></returns> /// <returns></returns>
TDocument GetByMax<TDocument>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, object>> orderByDescending, CancellationToken cancellationToken) TDocument GetByMax<TDocument>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, object>> orderByDescending,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>; where TDocument : IDocument<TKey>;
/// <summary> /// <summary>
@@ -481,7 +494,11 @@ namespace MongoDbGenericRepository
/// <param name="partitionKey">An optional partitionKey.</param> /// <param name="partitionKey">An optional partitionKey.</param>
/// <param name="cancellationToken">The cancellation token.</param> /// <param name="cancellationToken">The cancellation token.</param>
/// <returns></returns> /// <returns></returns>
TDocument GetByMax<TDocument>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, object>> orderByDescending, string partitionKey, CancellationToken cancellationToken) TDocument GetByMax<TDocument>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, object>> orderByDescending,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>; where TDocument : IDocument<TKey>;
/// <summary> /// <summary>
@@ -502,7 +519,10 @@ namespace MongoDbGenericRepository
/// <param name="filter">A LINQ expression filter.</param> /// <param name="filter">A LINQ expression filter.</param>
/// <param name="orderByAscending">A property selector to order by ascending.</param> /// <param name="orderByAscending">A property selector to order by ascending.</param>
/// <param name="cancellationToken">The cancellation token.</param> /// <param name="cancellationToken">The cancellation token.</param>
Task<TDocument> GetByMinAsync<TDocument>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, object>> orderByAscending, CancellationToken cancellationToken) Task<TDocument> GetByMinAsync<TDocument>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, object>> orderByAscending,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>; where TDocument : IDocument<TKey>;
/// <summary> /// <summary>
@@ -513,7 +533,10 @@ namespace MongoDbGenericRepository
/// <param name="filter">A LINQ expression filter.</param> /// <param name="filter">A LINQ expression filter.</param>
/// <param name="orderByAscending">A property selector to order by ascending.</param> /// <param name="orderByAscending">A property selector to order by ascending.</param>
/// <param name="partitionKey">An optional partitionKey.</param> /// <param name="partitionKey">An optional partitionKey.</param>
Task<TDocument> GetByMinAsync<TDocument>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, object>> orderByAscending, string partitionKey) Task<TDocument> GetByMinAsync<TDocument>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, object>> orderByAscending,
string partitionKey)
where TDocument : IDocument<TKey>; where TDocument : IDocument<TKey>;
/// <summary> /// <summary>
@@ -525,7 +548,11 @@ namespace MongoDbGenericRepository
/// <param name="orderByAscending">A property selector to order by ascending.</param> /// <param name="orderByAscending">A property selector to order by ascending.</param>
/// <param name="partitionKey">An optional partitionKey.</param> /// <param name="partitionKey">An optional partitionKey.</param>
/// <param name="cancellationToken">The cancellation token.</param> /// <param name="cancellationToken">The cancellation token.</param>
Task<TDocument> GetByMinAsync<TDocument>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, object>> orderByAscending, string partitionKey, CancellationToken cancellationToken) Task<TDocument> GetByMinAsync<TDocument>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, object>> orderByAscending,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>; where TDocument : IDocument<TKey>;
/// <summary> /// <summary>
@@ -546,7 +573,10 @@ namespace MongoDbGenericRepository
/// <param name="filter">A LINQ expression filter.</param> /// <param name="filter">A LINQ expression filter.</param>
/// <param name="orderByAscending">A property selector to order by ascending.</param> /// <param name="orderByAscending">A property selector to order by ascending.</param>
/// <param name="cancellationToken">The cancellation token.</param> /// <param name="cancellationToken">The cancellation token.</param>
TDocument GetByMin<TDocument>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, object>> orderByAscending, CancellationToken cancellationToken) TDocument GetByMin<TDocument>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, object>> orderByAscending,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>; where TDocument : IDocument<TKey>;
/// <summary> /// <summary>
@@ -569,7 +599,11 @@ namespace MongoDbGenericRepository
/// <param name="orderByAscending">A property selector to order by ascending.</param> /// <param name="orderByAscending">A property selector to order by ascending.</param>
/// <param name="partitionKey">An optional partitionKey.</param> /// <param name="partitionKey">An optional partitionKey.</param>
/// <param name="cancellationToken">The cancellation token.</param> /// <param name="cancellationToken">The cancellation token.</param>
TDocument GetByMin<TDocument>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, object>> orderByAscending, string partitionKey, CancellationToken cancellationToken) TDocument GetByMin<TDocument>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, object>> orderByAscending,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>; where TDocument : IDocument<TKey>;
/// <summary> /// <summary>
@@ -590,7 +624,10 @@ namespace MongoDbGenericRepository
/// <param name="filter">A LINQ expression filter.</param> /// <param name="filter">A LINQ expression filter.</param>
/// <param name="maxValueSelector">A property selector to order by ascending.</param> /// <param name="maxValueSelector">A property selector to order by ascending.</param>
/// <param name="cancellationToken">The cancellation token.</param> /// <param name="cancellationToken">The cancellation token.</param>
Task<TValue> GetMaxValueAsync<TDocument, TValue>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TValue>> maxValueSelector, CancellationToken cancellationToken) Task<TValue> GetMaxValueAsync<TDocument, TValue>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TValue>> maxValueSelector,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>; where TDocument : IDocument<TKey>;
/// <summary> /// <summary>
@@ -601,7 +638,10 @@ namespace MongoDbGenericRepository
/// <param name="filter">A LINQ expression filter.</param> /// <param name="filter">A LINQ expression filter.</param>
/// <param name="maxValueSelector">A property selector to order by ascending.</param> /// <param name="maxValueSelector">A property selector to order by ascending.</param>
/// <param name="partitionKey">An optional partitionKey.</param> /// <param name="partitionKey">An optional partitionKey.</param>
Task<TValue> GetMaxValueAsync<TDocument, TValue>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TValue>> maxValueSelector, string partitionKey) Task<TValue> GetMaxValueAsync<TDocument, TValue>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TValue>> maxValueSelector,
string partitionKey)
where TDocument : IDocument<TKey>; where TDocument : IDocument<TKey>;
/// <summary> /// <summary>
@@ -613,7 +653,11 @@ namespace MongoDbGenericRepository
/// <param name="maxValueSelector">A property selector to order by ascending.</param> /// <param name="maxValueSelector">A property selector to order by ascending.</param>
/// <param name="partitionKey">An optional partitionKey.</param> /// <param name="partitionKey">An optional partitionKey.</param>
/// <param name="cancellationToken">The cancellation token.</param> /// <param name="cancellationToken">The cancellation token.</param>
Task<TValue> GetMaxValueAsync<TDocument, TValue>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TValue>> maxValueSelector, string partitionKey, CancellationToken cancellationToken) Task<TValue> GetMaxValueAsync<TDocument, TValue>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TValue>> maxValueSelector,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>; where TDocument : IDocument<TKey>;
/// <summary> /// <summary>
@@ -634,7 +678,10 @@ namespace MongoDbGenericRepository
/// <param name="filter">A LINQ expression filter.</param> /// <param name="filter">A LINQ expression filter.</param>
/// <param name="maxValueSelector">A property selector to order by ascending.</param> /// <param name="maxValueSelector">A property selector to order by ascending.</param>
/// <param name="cancellationToken">The cancellation token.</param> /// <param name="cancellationToken">The cancellation token.</param>
TValue GetMaxValue<TDocument, TValue>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TValue>> maxValueSelector, CancellationToken cancellationToken) TValue GetMaxValue<TDocument, TValue>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TValue>> maxValueSelector,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>; where TDocument : IDocument<TKey>;
@@ -646,7 +693,10 @@ namespace MongoDbGenericRepository
/// <param name="filter">A LINQ expression filter.</param> /// <param name="filter">A LINQ expression filter.</param>
/// <param name="maxValueSelector">A property selector to order by ascending.</param> /// <param name="maxValueSelector">A property selector to order by ascending.</param>
/// <param name="partitionKey">An optional partitionKey.</param> /// <param name="partitionKey">An optional partitionKey.</param>
TValue GetMaxValue<TDocument, TValue>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TValue>> maxValueSelector, string partitionKey) TValue GetMaxValue<TDocument, TValue>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TValue>> maxValueSelector,
string partitionKey)
where TDocument : IDocument<TKey>; where TDocument : IDocument<TKey>;
/// <summary> /// <summary>
@@ -658,7 +708,11 @@ namespace MongoDbGenericRepository
/// <param name="maxValueSelector">A property selector to order by ascending.</param> /// <param name="maxValueSelector">A property selector to order by ascending.</param>
/// <param name="partitionKey">An optional partitionKey.</param> /// <param name="partitionKey">An optional partitionKey.</param>
/// <param name="cancellationToken">The cancellation token.</param> /// <param name="cancellationToken">The cancellation token.</param>
TValue GetMaxValue<TDocument, TValue>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TValue>> maxValueSelector, string partitionKey, CancellationToken cancellationToken) TValue GetMaxValue<TDocument, TValue>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TValue>> maxValueSelector,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>; where TDocument : IDocument<TKey>;
/// <summary> /// <summary>
@@ -680,7 +734,10 @@ namespace MongoDbGenericRepository
/// <param name="filter">A LINQ expression filter.</param> /// <param name="filter">A LINQ expression filter.</param>
/// <param name="minValueSelector">A property selector to order by ascending.</param> /// <param name="minValueSelector">A property selector to order by ascending.</param>
/// <param name="cancellationToken">The cancellation token.</param> /// <param name="cancellationToken">The cancellation token.</param>
Task<TValue> GetMinValueAsync<TDocument, TValue>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TValue>> minValueSelector, CancellationToken cancellationToken) Task<TValue> GetMinValueAsync<TDocument, TValue>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TValue>> minValueSelector,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>; where TDocument : IDocument<TKey>;
@@ -692,7 +749,10 @@ namespace MongoDbGenericRepository
/// <param name="filter">A LINQ expression filter.</param> /// <param name="filter">A LINQ expression filter.</param>
/// <param name="minValueSelector">A property selector to order by ascending.</param> /// <param name="minValueSelector">A property selector to order by ascending.</param>
/// <param name="partitionKey">An optional partition key.</param> /// <param name="partitionKey">An optional partition key.</param>
Task<TValue> GetMinValueAsync<TDocument, TValue>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TValue>> minValueSelector, string partitionKey) Task<TValue> GetMinValueAsync<TDocument, TValue>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TValue>> minValueSelector,
string partitionKey)
where TDocument : IDocument<TKey>; where TDocument : IDocument<TKey>;
/// <summary> /// <summary>
@@ -704,7 +764,11 @@ namespace MongoDbGenericRepository
/// <param name="minValueSelector">A property selector to order by ascending.</param> /// <param name="minValueSelector">A property selector to order by ascending.</param>
/// <param name="partitionKey">An optional partition key.</param> /// <param name="partitionKey">An optional partition key.</param>
/// <param name="cancellationToken">The cancellation token.</param> /// <param name="cancellationToken">The cancellation token.</param>
Task<TValue> GetMinValueAsync<TDocument, TValue>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TValue>> minValueSelector, string partitionKey, CancellationToken cancellationToken) Task<TValue> GetMinValueAsync<TDocument, TValue>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TValue>> minValueSelector,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>; where TDocument : IDocument<TKey>;
/// <summary> /// <summary>
@@ -725,7 +789,10 @@ namespace MongoDbGenericRepository
/// <param name="filter">A LINQ expression filter.</param> /// <param name="filter">A LINQ expression filter.</param>
/// <param name="minValueSelector">A property selector to order by ascending.</param> /// <param name="minValueSelector">A property selector to order by ascending.</param>
/// <param name="cancellationToken">The cancellation token.</param> /// <param name="cancellationToken">The cancellation token.</param>
TValue GetMinValue<TDocument, TValue>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TValue>> minValueSelector, CancellationToken cancellationToken) TValue GetMinValue<TDocument, TValue>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TValue>> minValueSelector,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>; where TDocument : IDocument<TKey>;
@@ -737,7 +804,10 @@ namespace MongoDbGenericRepository
/// <param name="filter">A LINQ expression filter.</param> /// <param name="filter">A LINQ expression filter.</param>
/// <param name="minValueSelector">A property selector to order by ascending.</param> /// <param name="minValueSelector">A property selector to order by ascending.</param>
/// <param name="partitionKey">An optional partition key.</param> /// <param name="partitionKey">An optional partition key.</param>
TValue GetMinValue<TDocument, TValue>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TValue>> minValueSelector, string partitionKey) TValue GetMinValue<TDocument, TValue>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TValue>> minValueSelector,
string partitionKey)
where TDocument : IDocument<TKey>; where TDocument : IDocument<TKey>;
/// <summary> /// <summary>
@@ -749,7 +819,11 @@ namespace MongoDbGenericRepository
/// <param name="minValueSelector">A property selector to order by ascending.</param> /// <param name="minValueSelector">A property selector to order by ascending.</param>
/// <param name="partitionKey">An optional partition key.</param> /// <param name="partitionKey">An optional partition key.</param>
/// <param name="cancellationToken">The cancellation token.</param> /// <param name="cancellationToken">The cancellation token.</param>
TValue GetMinValue<TDocument, TValue>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TValue>> minValueSelector, string partitionKey, CancellationToken cancellationToken) TValue GetMinValue<TDocument, TValue>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TValue>> minValueSelector,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>; where TDocument : IDocument<TKey>;
#endregion #endregion
@@ -772,7 +846,10 @@ namespace MongoDbGenericRepository
/// <param name="filter">A LINQ expression filter.</param> /// <param name="filter">A LINQ expression filter.</param>
/// <param name="selector">The field you want to sum.</param> /// <param name="selector">The field you want to sum.</param>
/// <param name="cancellationToken">The cancellation token.</param> /// <param name="cancellationToken">The cancellation token.</param>
Task<int> SumByAsync<TDocument>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, int>> selector, CancellationToken cancellationToken) Task<int> SumByAsync<TDocument>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, int>> selector,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>; where TDocument : IDocument<TKey>;
/// <summary> /// <summary>
@@ -793,7 +870,11 @@ namespace MongoDbGenericRepository
/// <param name="selector">The field you want to sum.</param> /// <param name="selector">The field you want to sum.</param>
/// <param name="partitionKey">The partition key of your document, if any.</param> /// <param name="partitionKey">The partition key of your document, if any.</param>
/// <param name="cancellationToken">The cancellation token.</param> /// <param name="cancellationToken">The cancellation token.</param>
Task<int> SumByAsync<TDocument>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, int>> selector, string partitionKey, CancellationToken cancellationToken) Task<int> SumByAsync<TDocument>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, int>> selector,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>; where TDocument : IDocument<TKey>;
/// <summary> /// <summary>
@@ -812,7 +893,10 @@ namespace MongoDbGenericRepository
/// <param name="filter">A LINQ expression filter.</param> /// <param name="filter">A LINQ expression filter.</param>
/// <param name="selector">The field you want to sum.</param> /// <param name="selector">The field you want to sum.</param>
/// <param name="cancellationToken">The cancellation token.</param> /// <param name="cancellationToken">The cancellation token.</param>
Task<decimal> SumByAsync<TDocument>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, decimal>> selector, CancellationToken cancellationToken) Task<decimal> SumByAsync<TDocument>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, decimal>> selector,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>; where TDocument : IDocument<TKey>;
/// <summary> /// <summary>
@@ -833,7 +917,11 @@ namespace MongoDbGenericRepository
/// <param name="selector">The field you want to sum.</param> /// <param name="selector">The field you want to sum.</param>
/// <param name="partitionKey">The partition key of your document, if any.</param> /// <param name="partitionKey">The partition key of your document, if any.</param>
/// <param name="cancellationToken">The cancellation token.</param> /// <param name="cancellationToken">The cancellation token.</param>
Task<decimal> SumByAsync<TDocument>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, decimal>> selector, string partitionKey, CancellationToken cancellationToken) Task<decimal> SumByAsync<TDocument>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, decimal>> selector,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>; where TDocument : IDocument<TKey>;
/// <summary> /// <summary>
@@ -885,7 +973,10 @@ namespace MongoDbGenericRepository
/// <param name="filter">A LINQ expression filter.</param> /// <param name="filter">A LINQ expression filter.</param>
/// <param name="projection">The projection expression.</param> /// <param name="projection">The projection expression.</param>
/// <param name="cancellationToken">The cancellation token</param> /// <param name="cancellationToken">The cancellation token</param>
Task<TProjection> ProjectOneAsync<TDocument, TProjection>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TProjection>> projection, CancellationToken cancellationToken) Task<TProjection> ProjectOneAsync<TDocument, TProjection>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TProjection>> projection,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TProjection : class; where TProjection : class;
@@ -897,7 +988,10 @@ namespace MongoDbGenericRepository
/// <param name="filter">A LINQ expression filter.</param> /// <param name="filter">A LINQ expression filter.</param>
/// <param name="projection">The projection expression.</param> /// <param name="projection">The projection expression.</param>
/// <param name="partitionKey">An optional partition key.</param> /// <param name="partitionKey">An optional partition key.</param>
Task<TProjection> ProjectOneAsync<TDocument, TProjection>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TProjection>> projection, string partitionKey) Task<TProjection> ProjectOneAsync<TDocument, TProjection>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TProjection>> projection,
string partitionKey)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TProjection : class; where TProjection : class;
@@ -910,9 +1004,14 @@ namespace MongoDbGenericRepository
/// <param name="projection">The projection expression.</param> /// <param name="projection">The projection expression.</param>
/// <param name="partitionKey">An optional partition key.</param> /// <param name="partitionKey">An optional partition key.</param>
/// <param name="cancellationToken">The cancellation token</param> /// <param name="cancellationToken">The cancellation token</param>
Task<TProjection> ProjectOneAsync<TDocument, TProjection>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TProjection>> projection, string partitionKey, CancellationToken cancellationToken) Task<TProjection> ProjectOneAsync<TDocument, TProjection>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TProjection>> projection,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TProjection : class; where TProjection : class;
/// <summary> /// <summary>
/// Returns a projected document matching the filter condition. /// Returns a projected document matching the filter condition.
/// </summary> /// </summary>
@@ -932,7 +1031,10 @@ namespace MongoDbGenericRepository
/// <param name="filter">A LINQ expression filter.</param> /// <param name="filter">A LINQ expression filter.</param>
/// <param name="projection">The projection expression.</param> /// <param name="projection">The projection expression.</param>
/// <param name="cancellationToken">The cancellation token.</param> /// <param name="cancellationToken">The cancellation token.</param>
TProjection ProjectOne<TDocument, TProjection>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TProjection>> projection, CancellationToken cancellationToken) TProjection ProjectOne<TDocument, TProjection>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TProjection>> projection,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TProjection : class; where TProjection : class;
@@ -944,7 +1046,10 @@ namespace MongoDbGenericRepository
/// <param name="filter">A LINQ expression filter.</param> /// <param name="filter">A LINQ expression filter.</param>
/// <param name="projection">The projection expression.</param> /// <param name="projection">The projection expression.</param>
/// <param name="partitionKey">An optional partition key.</param> /// <param name="partitionKey">An optional partition key.</param>
TProjection ProjectOne<TDocument, TProjection>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TProjection>> projection, string partitionKey) TProjection ProjectOne<TDocument, TProjection>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TProjection>> projection,
string partitionKey)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TProjection : class; where TProjection : class;
@@ -957,7 +1062,11 @@ namespace MongoDbGenericRepository
/// <param name="projection">The projection expression.</param> /// <param name="projection">The projection expression.</param>
/// <param name="partitionKey">An optional partition key.</param> /// <param name="partitionKey">An optional partition key.</param>
/// <param name="cancellationToken">The cancellation token.</param> /// <param name="cancellationToken">The cancellation token.</param>
TProjection ProjectOne<TDocument, TProjection>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TProjection>> projection, string partitionKey, CancellationToken cancellationToken) TProjection ProjectOne<TDocument, TProjection>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TProjection>> projection,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TProjection : class; where TProjection : class;
@@ -968,7 +1077,9 @@ namespace MongoDbGenericRepository
/// <typeparam name="TProjection">The type representing the model you want to project to.</typeparam> /// <typeparam name="TProjection">The type representing the model you want to project to.</typeparam>
/// <param name="filter">A LINQ expression filter.</param> /// <param name="filter">A LINQ expression filter.</param>
/// <param name="projection">The projection expression.</param> /// <param name="projection">The projection expression.</param>
Task<List<TProjection>> ProjectManyAsync<TDocument, TProjection>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TProjection>> projection) Task<List<TProjection>> ProjectManyAsync<TDocument, TProjection>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TProjection>> projection)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TProjection : class; where TProjection : class;
@@ -980,7 +1091,10 @@ namespace MongoDbGenericRepository
/// <param name="filter">A LINQ expression filter.</param> /// <param name="filter">A LINQ expression filter.</param>
/// <param name="projection">The projection expression.</param> /// <param name="projection">The projection expression.</param>
/// <param name="cancellationToken">The cancellation token.</param> /// <param name="cancellationToken">The cancellation token.</param>
Task<List<TProjection>> ProjectManyAsync<TDocument, TProjection>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TProjection>> projection, CancellationToken cancellationToken) Task<List<TProjection>> ProjectManyAsync<TDocument, TProjection>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TProjection>> projection,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TProjection : class; where TProjection : class;
@@ -992,7 +1106,10 @@ namespace MongoDbGenericRepository
/// <param name="filter">A LINQ expression filter.</param> /// <param name="filter">A LINQ expression filter.</param>
/// <param name="projection">The projection expression.</param> /// <param name="projection">The projection expression.</param>
/// <param name="partitionKey">An optional partition key.</param> /// <param name="partitionKey">An optional partition key.</param>
Task<List<TProjection>> ProjectManyAsync<TDocument, TProjection>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TProjection>> projection, string partitionKey) Task<List<TProjection>> ProjectManyAsync<TDocument, TProjection>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TProjection>> projection,
string partitionKey)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TProjection : class; where TProjection : class;
@@ -1005,7 +1122,11 @@ namespace MongoDbGenericRepository
/// <param name="projection">The projection expression.</param> /// <param name="projection">The projection expression.</param>
/// <param name="partitionKey">An optional partition key.</param> /// <param name="partitionKey">An optional partition key.</param>
/// <param name="cancellationToken">The cancellation token.</param> /// <param name="cancellationToken">The cancellation token.</param>
Task<List<TProjection>> ProjectManyAsync<TDocument, TProjection>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TProjection>> projection, string partitionKey, CancellationToken cancellationToken) Task<List<TProjection>> ProjectManyAsync<TDocument, TProjection>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TProjection>> projection,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TProjection : class; where TProjection : class;
@@ -1028,7 +1149,10 @@ namespace MongoDbGenericRepository
/// <param name="filter">A LINQ expression filter.</param> /// <param name="filter">A LINQ expression filter.</param>
/// <param name="projection">The projection expression.</param> /// <param name="projection">The projection expression.</param>
/// <param name="cancellationToken">The cancellation token</param> /// <param name="cancellationToken">The cancellation token</param>
List<TProjection> ProjectMany<TDocument, TProjection>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TProjection>> projection, CancellationToken cancellationToken) List<TProjection> ProjectMany<TDocument, TProjection>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TProjection>> projection,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TProjection : class; where TProjection : class;
@@ -1040,7 +1164,10 @@ namespace MongoDbGenericRepository
/// <param name="filter">A LINQ expression filter.</param> /// <param name="filter">A LINQ expression filter.</param>
/// <param name="projection">The projection expression.</param> /// <param name="projection">The projection expression.</param>
/// <param name="partitionKey">An optional partition key.</param> /// <param name="partitionKey">An optional partition key.</param>
List<TProjection> ProjectMany<TDocument, TProjection>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TProjection>> projection, string partitionKey) List<TProjection> ProjectMany<TDocument, TProjection>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TProjection>> projection,
string partitionKey)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TProjection : class; where TProjection : class;
@@ -1053,7 +1180,11 @@ namespace MongoDbGenericRepository
/// <param name="projection">The projection expression.</param> /// <param name="projection">The projection expression.</param>
/// <param name="partitionKey">An optional partition key.</param> /// <param name="partitionKey">An optional partition key.</param>
/// <param name="cancellationToken">The cancellation token</param> /// <param name="cancellationToken">The cancellation token</param>
List<TProjection> ProjectMany<TDocument, TProjection>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TProjection>> projection, string partitionKey, CancellationToken cancellationToken) List<TProjection> ProjectMany<TDocument, TProjection>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TProjection>> projection,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TProjection : class; where TProjection : class;
@@ -1070,7 +1201,9 @@ namespace MongoDbGenericRepository
/// <typeparam name="TProjection">The type of the projected group.</typeparam> /// <typeparam name="TProjection">The type of the projected group.</typeparam>
/// <param name="groupingCriteria">The grouping criteria.</param> /// <param name="groupingCriteria">The grouping criteria.</param>
/// <param name="groupProjection">The projected group result.</param> /// <param name="groupProjection">The projected group result.</param>
List<TProjection> GroupBy<TDocument, TGroupKey, TProjection>(Expression<Func<TDocument, TGroupKey>> groupingCriteria, Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection) List<TProjection> GroupBy<TDocument, TGroupKey, TProjection>(
Expression<Func<TDocument, TGroupKey>> groupingCriteria,
Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TProjection : class, new(); where TProjection : class, new();
@@ -1084,7 +1217,10 @@ namespace MongoDbGenericRepository
/// <param name="groupingCriteria">The grouping criteria.</param> /// <param name="groupingCriteria">The grouping criteria.</param>
/// <param name="groupProjection">The projected group result.</param> /// <param name="groupProjection">The projected group result.</param>
/// <param name="cancellationToken">The cancellation token.</param> /// <param name="cancellationToken">The cancellation token.</param>
List<TProjection> GroupBy<TDocument, TGroupKey, TProjection>(Expression<Func<TDocument, TGroupKey>> groupingCriteria, Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection, CancellationToken cancellationToken) List<TProjection> GroupBy<TDocument, TGroupKey, TProjection>(
Expression<Func<TDocument, TGroupKey>> groupingCriteria,
Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TProjection : class, new(); where TProjection : class, new();
@@ -1098,7 +1234,10 @@ namespace MongoDbGenericRepository
/// <param name="groupingCriteria">The grouping criteria.</param> /// <param name="groupingCriteria">The grouping criteria.</param>
/// <param name="groupProjection">The projected group result.</param> /// <param name="groupProjection">The projected group result.</param>
/// <param name="partitionKey">The partition key of your document, if any.</param> /// <param name="partitionKey">The partition key of your document, if any.</param>
List<TProjection> GroupBy<TDocument, TGroupKey, TProjection>(Expression<Func<TDocument, TGroupKey>> groupingCriteria, Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection, string partitionKey) List<TProjection> GroupBy<TDocument, TGroupKey, TProjection>(
Expression<Func<TDocument, TGroupKey>> groupingCriteria,
Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection,
string partitionKey)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TProjection : class, new(); where TProjection : class, new();
@@ -1113,7 +1252,11 @@ namespace MongoDbGenericRepository
/// <param name="groupProjection">The projected group result.</param> /// <param name="groupProjection">The projected group result.</param>
/// <param name="partitionKey">The partition key of your document, if any.</param> /// <param name="partitionKey">The partition key of your document, if any.</param>
/// <param name="cancellationToken">The cancellation token.</param> /// <param name="cancellationToken">The cancellation token.</param>
List<TProjection> GroupBy<TDocument, TGroupKey, TProjection>(Expression<Func<TDocument, TGroupKey>> groupingCriteria, Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection, string partitionKey, CancellationToken cancellationToken) List<TProjection> GroupBy<TDocument, TGroupKey, TProjection>(
Expression<Func<TDocument, TGroupKey>> groupingCriteria,
Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TProjection : class, new(); where TProjection : class, new();
@@ -1127,7 +1270,10 @@ namespace MongoDbGenericRepository
/// <param name="filter">A LINQ expression filter.</param> /// <param name="filter">A LINQ expression filter.</param>
/// <param name="groupingCriteria">The grouping criteria.</param> /// <param name="groupingCriteria">The grouping criteria.</param>
/// <param name="groupProjection">The projected group result.</param> /// <param name="groupProjection">The projected group result.</param>
List<TProjection> GroupBy<TDocument, TGroupKey, TProjection>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TGroupKey>> groupingCriteria, Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection) List<TProjection> GroupBy<TDocument, TGroupKey, TProjection>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TGroupKey>> groupingCriteria,
Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TProjection : class, new(); where TProjection : class, new();
@@ -1142,7 +1288,11 @@ namespace MongoDbGenericRepository
/// <param name="groupingCriteria">The grouping criteria.</param> /// <param name="groupingCriteria">The grouping criteria.</param>
/// <param name="groupProjection">The projected group result.</param> /// <param name="groupProjection">The projected group result.</param>
/// <param name="cancellationToken">The cancellation token.</param> /// <param name="cancellationToken">The cancellation token.</param>
List<TProjection> GroupBy<TDocument, TGroupKey, TProjection>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TGroupKey>> groupingCriteria, Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection, CancellationToken cancellationToken) List<TProjection> GroupBy<TDocument, TGroupKey, TProjection>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TGroupKey>> groupingCriteria,
Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TProjection : class, new(); where TProjection : class, new();
@@ -1157,7 +1307,11 @@ namespace MongoDbGenericRepository
/// <param name="groupingCriteria">The grouping criteria.</param> /// <param name="groupingCriteria">The grouping criteria.</param>
/// <param name="groupProjection">The projected group result.</param> /// <param name="groupProjection">The projected group result.</param>
/// <param name="partitionKey">The partition key of your document, if any.</param> /// <param name="partitionKey">The partition key of your document, if any.</param>
List<TProjection> GroupBy<TDocument, TGroupKey, TProjection>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TGroupKey>> groupingCriteria, Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection, string partitionKey) List<TProjection> GroupBy<TDocument, TGroupKey, TProjection>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TGroupKey>> groupingCriteria,
Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection,
string partitionKey)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TProjection : class, new(); where TProjection : class, new();
@@ -1173,7 +1327,12 @@ namespace MongoDbGenericRepository
/// <param name="groupProjection">The projected group result.</param> /// <param name="groupProjection">The projected group result.</param>
/// <param name="partitionKey">The partition key of your document, if any.</param> /// <param name="partitionKey">The partition key of your document, if any.</param>
/// <param name="cancellationToken">The cancellation token.</param> /// <param name="cancellationToken">The cancellation token.</param>
List<TProjection> GroupBy<TDocument, TGroupKey, TProjection>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TGroupKey>> groupingCriteria, Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection, string partitionKey, CancellationToken cancellationToken) List<TProjection> GroupBy<TDocument, TGroupKey, TProjection>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TGroupKey>> groupingCriteria,
Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TProjection : class, new(); where TProjection : class, new();
@@ -7,6 +7,5 @@ namespace MongoDbGenericRepository
/// </summary> /// </summary>
public interface IReadOnlyMongoRepository : IBaseReadOnlyRepository, IReadOnlyMongoRepository<Guid> public interface IReadOnlyMongoRepository : IBaseReadOnlyRepository, IReadOnlyMongoRepository<Guid>
{ {
} }
} }
@@ -422,7 +422,10 @@ namespace MongoDbGenericRepository
} }
/// <inheritdoc /> /// <inheritdoc />
public async Task<string> CreateDescendingIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, CancellationToken cancellationToken) public async Task<string> CreateDescendingIndexAsync<TDocument>(
Expression<Func<TDocument, object>> field,
IndexCreationOptions indexCreationOptions,
CancellationToken cancellationToken)
where TDocument : IDocument<Guid> where TDocument : IDocument<Guid>
{ {
return await CreateDescendingIndexAsync<TDocument, Guid>(field, indexCreationOptions, null, cancellationToken); return await CreateDescendingIndexAsync<TDocument, Guid>(field, indexCreationOptions, null, cancellationToken);
@@ -436,21 +439,31 @@ namespace MongoDbGenericRepository
} }
/// <inheritdoc /> /// <inheritdoc />
public async Task<string> CreateDescendingIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, string partitionKey, CancellationToken cancellationToken) public async Task<string> CreateDescendingIndexAsync<TDocument>(
Expression<Func<TDocument, object>> field,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<Guid> where TDocument : IDocument<Guid>
{ {
return await CreateDescendingIndexAsync<TDocument, Guid>(field, null, partitionKey, cancellationToken); return await CreateDescendingIndexAsync<TDocument, Guid>(field, null, partitionKey, cancellationToken);
} }
/// <inheritdoc /> /// <inheritdoc />
public async Task<string> CreateDescendingIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, string partitionKey) public async Task<string> CreateDescendingIndexAsync<TDocument>(
Expression<Func<TDocument, object>> field,
IndexCreationOptions indexCreationOptions,
string partitionKey)
where TDocument : IDocument<Guid> where TDocument : IDocument<Guid>
{ {
return await CreateDescendingIndexAsync<TDocument, Guid>(field, indexCreationOptions, partitionKey, CancellationToken.None); return await CreateDescendingIndexAsync<TDocument, Guid>(field, indexCreationOptions, partitionKey, CancellationToken.None);
} }
/// <inheritdoc /> /// <inheritdoc />
public async Task<string> CreateDescendingIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, string partitionKey, CancellationToken cancellationToken) public async Task<string> CreateDescendingIndexAsync<TDocument>(
Expression<Func<TDocument, object>> field,
IndexCreationOptions indexCreationOptions,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<Guid> where TDocument : IDocument<Guid>
{ {
return await CreateDescendingIndexAsync<TDocument, Guid>(field, indexCreationOptions, partitionKey, cancellationToken); return await CreateDescendingIndexAsync<TDocument, Guid>(field, indexCreationOptions, partitionKey, cancellationToken);
@@ -465,7 +478,9 @@ namespace MongoDbGenericRepository
} }
/// <inheritdoc /> /// <inheritdoc />
public virtual async Task<string> CreateDescendingIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, CancellationToken cancellationToken) public virtual async Task<string> CreateDescendingIndexAsync<TDocument, TKey>(
Expression<Func<TDocument, object>> field,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey> where TKey : IEquatable<TKey>
{ {
@@ -473,7 +488,9 @@ namespace MongoDbGenericRepository
} }
/// <inheritdoc /> /// <inheritdoc />
public virtual async Task<string> CreateDescendingIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions) public virtual async Task<string> CreateDescendingIndexAsync<TDocument, TKey>(
Expression<Func<TDocument, object>> field,
IndexCreationOptions indexCreationOptions)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey> where TKey : IEquatable<TKey>
{ {
@@ -482,7 +499,10 @@ namespace MongoDbGenericRepository
/// <inheritdoc /> /// <inheritdoc />
public virtual async Task<string> CreateDescendingIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, CancellationToken cancellationToken) public virtual async Task<string> CreateDescendingIndexAsync<TDocument, TKey>(
Expression<Func<TDocument, object>> field,
IndexCreationOptions indexCreationOptions,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey> where TKey : IEquatable<TKey>
{ {
@@ -498,7 +518,10 @@ namespace MongoDbGenericRepository
} }
/// <inheritdoc /> /// <inheritdoc />
public virtual async Task<string> CreateDescendingIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, string partitionKey, CancellationToken cancellationToken) public virtual async Task<string> CreateDescendingIndexAsync<TDocument, TKey>(
Expression<Func<TDocument, object>> field,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey> where TKey : IEquatable<TKey>
{ {
@@ -506,7 +529,10 @@ namespace MongoDbGenericRepository
} }
/// <inheritdoc /> /// <inheritdoc />
public virtual async Task<string> CreateDescendingIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, string partitionKey) public virtual async Task<string> CreateDescendingIndexAsync<TDocument, TKey>(
Expression<Func<TDocument, object>> field,
IndexCreationOptions indexCreationOptions,
string partitionKey)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey> where TKey : IEquatable<TKey>
{ {
@@ -514,7 +540,11 @@ namespace MongoDbGenericRepository
} }
/// <inheritdoc /> /// <inheritdoc />
public virtual async Task<string> CreateDescendingIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, string partitionKey, CancellationToken cancellationToken) public virtual async Task<string> CreateDescendingIndexAsync<TDocument, TKey>(
Expression<Func<TDocument, object>> field,
IndexCreationOptions indexCreationOptions,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey> where TKey : IEquatable<TKey>
{ {
@@ -543,7 +573,10 @@ namespace MongoDbGenericRepository
} }
/// <inheritdoc /> /// <inheritdoc />
public async Task<string> CreateHashedIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, CancellationToken cancellationToken) public async Task<string> CreateHashedIndexAsync<TDocument>(
Expression<Func<TDocument, object>> field,
IndexCreationOptions indexCreationOptions,
CancellationToken cancellationToken)
where TDocument : IDocument<Guid> where TDocument : IDocument<Guid>
{ {
return await CreateHashedIndexAsync<TDocument, Guid>(field, indexCreationOptions, null, cancellationToken); return await CreateHashedIndexAsync<TDocument, Guid>(field, indexCreationOptions, null, cancellationToken);
@@ -557,21 +590,31 @@ namespace MongoDbGenericRepository
} }
/// <inheritdoc /> /// <inheritdoc />
public async Task<string> CreateHashedIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, string partitionKey, CancellationToken cancellationToken) public async Task<string> CreateHashedIndexAsync<TDocument>(
Expression<Func<TDocument, object>> field,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<Guid> where TDocument : IDocument<Guid>
{ {
return await CreateHashedIndexAsync<TDocument, Guid>(field, null, partitionKey, cancellationToken); return await CreateHashedIndexAsync<TDocument, Guid>(field, null, partitionKey, cancellationToken);
} }
/// <inheritdoc /> /// <inheritdoc />
public async Task<string> CreateHashedIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, string partitionKey) public async Task<string> CreateHashedIndexAsync<TDocument>(
Expression<Func<TDocument, object>> field,
IndexCreationOptions indexCreationOptions,
string partitionKey)
where TDocument : IDocument<Guid> where TDocument : IDocument<Guid>
{ {
return await CreateHashedIndexAsync<TDocument, Guid>(field, indexCreationOptions, partitionKey, CancellationToken.None); return await CreateHashedIndexAsync<TDocument, Guid>(field, indexCreationOptions, partitionKey, CancellationToken.None);
} }
/// <inheritdoc /> /// <inheritdoc />
public async Task<string> CreateHashedIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, string partitionKey, CancellationToken cancellationToken) public async Task<string> CreateHashedIndexAsync<TDocument>(
Expression<Func<TDocument, object>> field,
IndexCreationOptions indexCreationOptions,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<Guid> where TDocument : IDocument<Guid>
{ {
return await CreateHashedIndexAsync<TDocument, Guid>(field, indexCreationOptions, partitionKey, cancellationToken); return await CreateHashedIndexAsync<TDocument, Guid>(field, indexCreationOptions, partitionKey, cancellationToken);
@@ -586,7 +629,9 @@ namespace MongoDbGenericRepository
} }
/// <inheritdoc /> /// <inheritdoc />
public virtual async Task<string> CreateHashedIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, CancellationToken cancellationToken) public virtual async Task<string> CreateHashedIndexAsync<TDocument, TKey>(
Expression<Func<TDocument, object>> field,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey> where TKey : IEquatable<TKey>
{ {
@@ -594,7 +639,9 @@ namespace MongoDbGenericRepository
} }
/// <inheritdoc /> /// <inheritdoc />
public virtual async Task<string> CreateHashedIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions) public virtual async Task<string> CreateHashedIndexAsync<TDocument, TKey>(
Expression<Func<TDocument, object>> field,
IndexCreationOptions indexCreationOptions)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey> where TKey : IEquatable<TKey>
{ {
@@ -602,7 +649,10 @@ namespace MongoDbGenericRepository
} }
/// <inheritdoc /> /// <inheritdoc />
public virtual async Task<string> CreateHashedIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, CancellationToken cancellationToken) public virtual async Task<string> CreateHashedIndexAsync<TDocument, TKey>(
Expression<Func<TDocument, object>> field,
IndexCreationOptions indexCreationOptions,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey> where TKey : IEquatable<TKey>
{ {
@@ -618,7 +668,10 @@ namespace MongoDbGenericRepository
} }
/// <inheritdoc /> /// <inheritdoc />
public virtual async Task<string> CreateHashedIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, string partitionKey, CancellationToken cancellationToken) public virtual async Task<string> CreateHashedIndexAsync<TDocument, TKey>(
Expression<Func<TDocument, object>> field,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey> where TKey : IEquatable<TKey>
{ {
@@ -626,7 +679,10 @@ namespace MongoDbGenericRepository
} }
/// <inheritdoc /> /// <inheritdoc />
public virtual async Task<string> CreateHashedIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, string partitionKey) public virtual async Task<string> CreateHashedIndexAsync<TDocument, TKey>(
Expression<Func<TDocument, object>> field,
IndexCreationOptions indexCreationOptions,
string partitionKey)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey> where TKey : IEquatable<TKey>
{ {
@@ -634,7 +690,11 @@ namespace MongoDbGenericRepository
} }
/// <inheritdoc /> /// <inheritdoc />
public virtual async Task<string> CreateHashedIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, string partitionKey, CancellationToken cancellationToken) public virtual async Task<string> CreateHashedIndexAsync<TDocument, TKey>(
Expression<Func<TDocument, object>> field,
IndexCreationOptions indexCreationOptions,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey> where TKey : IEquatable<TKey>
{ {
@@ -649,21 +709,28 @@ namespace MongoDbGenericRepository
} }
/// <inheritdoc /> /// <inheritdoc />
public async Task<string> CreateCombinedTextIndexAsync<TDocument>(IEnumerable<Expression<Func<TDocument, object>>> fields, CancellationToken cancellationToken) public async Task<string> CreateCombinedTextIndexAsync<TDocument>(
IEnumerable<Expression<Func<TDocument, object>>> fields,
CancellationToken cancellationToken)
where TDocument : IDocument<Guid> where TDocument : IDocument<Guid>
{ {
return await CreateCombinedTextIndexAsync<TDocument, Guid>(fields, null, null, cancellationToken); return await CreateCombinedTextIndexAsync<TDocument, Guid>(fields, null, null, cancellationToken);
} }
/// <inheritdoc /> /// <inheritdoc />
public async Task<string> CreateCombinedTextIndexAsync<TDocument>(IEnumerable<Expression<Func<TDocument, object>>> fields, IndexCreationOptions indexCreationOptions) public async Task<string> CreateCombinedTextIndexAsync<TDocument>(
IEnumerable<Expression<Func<TDocument, object>>> fields,
IndexCreationOptions indexCreationOptions)
where TDocument : IDocument<Guid> where TDocument : IDocument<Guid>
{ {
return await CreateCombinedTextIndexAsync<TDocument, Guid>(fields, indexCreationOptions, null, CancellationToken.None); return await CreateCombinedTextIndexAsync<TDocument, Guid>(fields, indexCreationOptions, null, CancellationToken.None);
} }
/// <inheritdoc /> /// <inheritdoc />
public async Task<string> CreateCombinedTextIndexAsync<TDocument>(IEnumerable<Expression<Func<TDocument, object>>> fields, IndexCreationOptions indexCreationOptions, CancellationToken cancellationToken) public async Task<string> CreateCombinedTextIndexAsync<TDocument>(
IEnumerable<Expression<Func<TDocument, object>>> fields,
IndexCreationOptions indexCreationOptions,
CancellationToken cancellationToken)
where TDocument : IDocument<Guid> where TDocument : IDocument<Guid>
{ {
return await CreateCombinedTextIndexAsync<TDocument, Guid>(fields, indexCreationOptions, null, cancellationToken); return await CreateCombinedTextIndexAsync<TDocument, Guid>(fields, indexCreationOptions, null, cancellationToken);
@@ -677,21 +744,31 @@ namespace MongoDbGenericRepository
} }
/// <inheritdoc /> /// <inheritdoc />
public async Task<string> CreateCombinedTextIndexAsync<TDocument>(IEnumerable<Expression<Func<TDocument, object>>> fields, string partitionKey, CancellationToken cancellationToken) public async Task<string> CreateCombinedTextIndexAsync<TDocument>(
IEnumerable<Expression<Func<TDocument, object>>> fields,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<Guid> where TDocument : IDocument<Guid>
{ {
return await CreateCombinedTextIndexAsync<TDocument, Guid>(fields, null, partitionKey, cancellationToken); return await CreateCombinedTextIndexAsync<TDocument, Guid>(fields, null, partitionKey, cancellationToken);
} }
/// <inheritdoc /> /// <inheritdoc />
public async Task<string> CreateCombinedTextIndexAsync<TDocument>(IEnumerable<Expression<Func<TDocument, object>>> fields, IndexCreationOptions indexCreationOptions, string partitionKey) public async Task<string> CreateCombinedTextIndexAsync<TDocument>(
IEnumerable<Expression<Func<TDocument, object>>> fields,
IndexCreationOptions indexCreationOptions,
string partitionKey)
where TDocument : IDocument<Guid> where TDocument : IDocument<Guid>
{ {
return await CreateCombinedTextIndexAsync<TDocument, Guid>(fields, indexCreationOptions, partitionKey, CancellationToken.None); return await CreateCombinedTextIndexAsync<TDocument, Guid>(fields, indexCreationOptions, partitionKey, CancellationToken.None);
} }
/// <inheritdoc /> /// <inheritdoc />
public async Task<string> CreateCombinedTextIndexAsync<TDocument>(IEnumerable<Expression<Func<TDocument, object>>> fields, IndexCreationOptions indexCreationOptions, string partitionKey, CancellationToken cancellationToken) public async Task<string> CreateCombinedTextIndexAsync<TDocument>(
IEnumerable<Expression<Func<TDocument, object>>> fields,
IndexCreationOptions indexCreationOptions,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<Guid> where TDocument : IDocument<Guid>
{ {
return await CreateCombinedTextIndexAsync<TDocument, Guid>(fields, indexCreationOptions, partitionKey, cancellationToken); return await CreateCombinedTextIndexAsync<TDocument, Guid>(fields, indexCreationOptions, partitionKey, cancellationToken);
@@ -706,7 +783,9 @@ namespace MongoDbGenericRepository
} }
/// <inheritdoc /> /// <inheritdoc />
public virtual async Task<string> CreateCombinedTextIndexAsync<TDocument, TKey>(IEnumerable<Expression<Func<TDocument, object>>> fields, CancellationToken cancellationToken) public virtual async Task<string> CreateCombinedTextIndexAsync<TDocument, TKey>(
IEnumerable<Expression<Func<TDocument, object>>> fields,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey> where TKey : IEquatable<TKey>
{ {
@@ -714,7 +793,9 @@ namespace MongoDbGenericRepository
} }
/// <inheritdoc /> /// <inheritdoc />
public virtual async Task<string> CreateCombinedTextIndexAsync<TDocument, TKey>(IEnumerable<Expression<Func<TDocument, object>>> fields, IndexCreationOptions indexCreationOptions) public virtual async Task<string> CreateCombinedTextIndexAsync<TDocument, TKey>(
IEnumerable<Expression<Func<TDocument, object>>> fields,
IndexCreationOptions indexCreationOptions)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey> where TKey : IEquatable<TKey>
{ {
@@ -722,7 +803,10 @@ namespace MongoDbGenericRepository
} }
/// <inheritdoc /> /// <inheritdoc />
public virtual async Task<string> CreateCombinedTextIndexAsync<TDocument, TKey>(IEnumerable<Expression<Func<TDocument, object>>> fields, IndexCreationOptions indexCreationOptions, CancellationToken cancellationToken) public virtual async Task<string> CreateCombinedTextIndexAsync<TDocument, TKey>(
IEnumerable<Expression<Func<TDocument, object>>> fields,
IndexCreationOptions indexCreationOptions,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey> where TKey : IEquatable<TKey>
{ {
@@ -730,7 +814,9 @@ namespace MongoDbGenericRepository
} }
/// <inheritdoc /> /// <inheritdoc />
public virtual async Task<string> CreateCombinedTextIndexAsync<TDocument, TKey>(IEnumerable<Expression<Func<TDocument, object>>> fields, string partitionKey) public virtual async Task<string> CreateCombinedTextIndexAsync<TDocument, TKey>(
IEnumerable<Expression<Func<TDocument, object>>> fields,
string partitionKey)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey> where TKey : IEquatable<TKey>
{ {
@@ -738,7 +824,10 @@ namespace MongoDbGenericRepository
} }
/// <inheritdoc /> /// <inheritdoc />
public virtual async Task<string> CreateCombinedTextIndexAsync<TDocument, TKey>(IEnumerable<Expression<Func<TDocument, object>>> fields, string partitionKey, CancellationToken cancellationToken) public virtual async Task<string> CreateCombinedTextIndexAsync<TDocument, TKey>(
IEnumerable<Expression<Func<TDocument, object>>> fields,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey> where TKey : IEquatable<TKey>
{ {
@@ -746,7 +835,10 @@ namespace MongoDbGenericRepository
} }
/// <inheritdoc /> /// <inheritdoc />
public virtual async Task<string> CreateCombinedTextIndexAsync<TDocument, TKey>(IEnumerable<Expression<Func<TDocument, object>>> fields, IndexCreationOptions indexCreationOptions, string partitionKey) public virtual async Task<string> CreateCombinedTextIndexAsync<TDocument, TKey>(
IEnumerable<Expression<Func<TDocument, object>>> fields,
IndexCreationOptions indexCreationOptions,
string partitionKey)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey> where TKey : IEquatable<TKey>
{ {
@@ -754,7 +846,11 @@ namespace MongoDbGenericRepository
} }
/// <inheritdoc /> /// <inheritdoc />
public virtual async Task<string> CreateCombinedTextIndexAsync<TDocument, TKey>(IEnumerable<Expression<Func<TDocument, object>>> fields, IndexCreationOptions indexCreationOptions, string partitionKey, CancellationToken cancellationToken) public virtual async Task<string> CreateCombinedTextIndexAsync<TDocument, TKey>(
IEnumerable<Expression<Func<TDocument, object>>> fields,
IndexCreationOptions indexCreationOptions,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey> where TKey : IEquatable<TKey>
{ {
@@ -1,21 +1,21 @@
using MongoDB.Driver; using System;
using MongoDbGenericRepository.Models;
using MongoDbGenericRepository.Utils;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq.Expressions; using System.Linq.Expressions;
using System.Threading.Tasks; using System.Threading.Tasks;
using MongoDB.Driver;
using MongoDbGenericRepository.Models;
using MongoDbGenericRepository.Utils;
namespace MongoDbGenericRepository namespace MongoDbGenericRepository
{ {
/// <summary> /// <summary>
/// The base Repository, it is meant to be inherited from by your custom custom MongoRepository implementation. /// The base Repository, it is meant to be inherited from by your custom custom MongoRepository implementation.
/// Its constructor must be given a connection string and a database name. /// Its constructor must be given a connection string and a database name.
/// </summary> /// </summary>
public abstract partial class BaseMongoRepository : ReadOnlyMongoRepository, IBaseMongoRepository public abstract partial class BaseMongoRepository : ReadOnlyMongoRepository, IBaseMongoRepository
{ {
/// <summary> /// <summary>
/// The constructor taking a connection string and a database name. /// The constructor taking a connection string and a database name.
/// </summary> /// </summary>
/// <param name="connectionString">The connection string of the MongoDb server.</param> /// <param name="connectionString">The connection string of the MongoDb server.</param>
/// <param name="databaseName">The name of the database against which you want to perform operations.</param> /// <param name="databaseName">The name of the database against which you want to perform operations.</param>
@@ -24,23 +24,23 @@ namespace MongoDbGenericRepository
} }
/// <summary> /// <summary>
/// The constructor taking a <see cref="IMongoDbContext"/>. /// The constructor taking a <see cref="IMongoDbContext" />.
/// </summary> /// </summary>
/// <param name="mongoDbContext">A mongodb context implementing <see cref="IMongoDbContext"/></param> /// <param name="mongoDbContext">A mongodb context implementing <see cref="IMongoDbContext" /></param>
protected BaseMongoRepository(IMongoDbContext mongoDbContext) : base(mongoDbContext) protected BaseMongoRepository(IMongoDbContext mongoDbContext) : base(mongoDbContext)
{ {
} }
/// <summary> /// <summary>
/// The constructor taking a <see cref="IMongoDatabase"/>. /// The constructor taking a <see cref="IMongoDatabase" />.
/// </summary> /// </summary>
/// <param name="mongoDatabase">A mongodb context implementing <see cref="IMongoDatabase"/></param> /// <param name="mongoDatabase">A mongodb context implementing <see cref="IMongoDatabase" /></param>
protected BaseMongoRepository(IMongoDatabase mongoDatabase) : base(mongoDatabase) protected BaseMongoRepository(IMongoDatabase mongoDatabase) : base(mongoDatabase)
{ {
} }
/// <summary> /// <summary>
/// Asynchronously returns a paginated list of the documents matching the filter condition. /// Asynchronously returns a paginated list of the documents matching the filter condition.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <param name="filter">A LINQ expression filter.</param> /// <param name="filter">A LINQ expression filter.</param>
@@ -58,7 +58,7 @@ namespace MongoDbGenericRepository
} }
/// <summary> /// <summary>
/// Asynchronously returns a paginated list of the documents matching the filter condition. /// Asynchronously returns a paginated list of the documents matching the filter condition.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -66,48 +66,19 @@ namespace MongoDbGenericRepository
/// <param name="skipNumber">The number of documents you want to skip. Default value is 0.</param> /// <param name="skipNumber">The number of documents you want to skip. Default value is 0.</param>
/// <param name="takeNumber">The number of documents you want to take. Default value is 50.</param> /// <param name="takeNumber">The number of documents you want to take. Default value is 50.</param>
/// <param name="partitionKey">An optional partition key.</param> /// <param name="partitionKey">An optional partition key.</param>
public virtual async Task<List<TDocument>> GetPaginatedAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, int skipNumber = 0, int takeNumber = 50, string partitionKey = null) public virtual async Task<List<TDocument>> GetPaginatedAsync<TDocument, TKey>(
Expression<Func<TDocument, bool>> filter,
int skipNumber = 0,
int takeNumber = 50,
string partitionKey = null)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey> where TKey : IEquatable<TKey>
{ {
return await HandlePartitioned<TDocument, TKey>(partitionKey).Find(filter).Skip(skipNumber).Limit(takeNumber).ToListAsync(); return await HandlePartitioned<TDocument, TKey>(partitionKey).Find(filter).Skip(skipNumber).Limit(takeNumber).ToListAsync();
} }
#region Find And Update
/// <summary> /// <summary>
/// GetAndUpdateOne with filter /// Sets the value of the document Id if it is not set already.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="update"></param>
/// <param name="options"></param>
/// <returns></returns>
public virtual async Task<TDocument> GetAndUpdateOne<TDocument>(FilterDefinition<TDocument> filter, UpdateDefinition<TDocument> update, FindOneAndUpdateOptions<TDocument, TDocument> options) where TDocument : IDocument
{
return await GetCollection<TDocument>().FindOneAndUpdateAsync(filter, update, options);
}
/// <summary>
/// GetAndUpdateOne with filter
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="update"></param>
/// <param name="options"></param>
/// <returns></returns>
public virtual async Task<TDocument> GetAndUpdateOne<TDocument, TKey>(FilterDefinition<TDocument> filter, UpdateDefinition<TDocument> update, FindOneAndUpdateOptions<TDocument, TDocument> options)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>
{
return await GetCollection<TDocument, TKey>().FindOneAndUpdateAsync(filter, update, options);
}
#endregion Find And Update
/// <summary>
/// Sets the value of the document Id if it is not set already.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The document type.</typeparam> /// <typeparam name="TDocument">The document type.</typeparam>
/// <typeparam name="TKey">The type of the primary key.</typeparam> /// <typeparam name="TKey">The type of the primary key.</typeparam>
@@ -120,6 +91,7 @@ namespace MongoDbGenericRepository
{ {
throw new ArgumentNullException(nameof(document)); throw new ArgumentNullException(nameof(document));
} }
var defaultTKey = default(TKey); var defaultTKey = default(TKey);
if (document.Id == null if (document.Id == null
|| (defaultTKey != null || (defaultTKey != null
@@ -130,24 +102,26 @@ namespace MongoDbGenericRepository
} }
/// <summary> /// <summary>
/// Sets the value of the document Id if it is not set already. /// Sets the value of the document Id if it is not set already.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The document type.</typeparam> /// <typeparam name="TDocument">The document type.</typeparam>
/// <param name="document">The document.</param> /// <param name="document">The document.</param>
protected void FormatDocument<TDocument>(TDocument document) where TDocument : IDocument protected void FormatDocument<TDocument>(TDocument document)
where TDocument : IDocument
{ {
if (document == null) if (document == null)
{ {
throw new ArgumentNullException(nameof(document)); throw new ArgumentNullException(nameof(document));
} }
if (document.Id == default(Guid))
if (document.Id == default)
{ {
document.Id = Guid.NewGuid(); document.Id = Guid.NewGuid();
} }
} }
/// <summary> /// <summary>
/// Gets a collections for a potentially partitioned document type. /// Gets a collections for a potentially partitioned document type.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The document type.</typeparam> /// <typeparam name="TDocument">The document type.</typeparam>
/// <param name="partitionKey">The collection partition key.</param> /// <param name="partitionKey">The collection partition key.</param>
@@ -159,11 +133,12 @@ namespace MongoDbGenericRepository
{ {
return GetCollection<TDocument>(partitionKey); return GetCollection<TDocument>(partitionKey);
} }
return GetCollection<TDocument>(); return GetCollection<TDocument>();
} }
/// <summary> /// <summary>
/// Gets a collections for the type TDocument with a partition key. /// Gets a collections for the type TDocument with a partition key.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The document type.</typeparam> /// <typeparam name="TDocument">The document type.</typeparam>
/// <param name="partitionKey">The collection partition key.</param> /// <param name="partitionKey">The collection partition key.</param>
@@ -173,5 +148,45 @@ namespace MongoDbGenericRepository
{ {
return MongoDbContext.GetCollection<TDocument>(partitionKey); return MongoDbContext.GetCollection<TDocument>(partitionKey);
} }
#region Find And Update
/// <summary>
/// GetAndUpdateOne with filter
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="update"></param>
/// <param name="options"></param>
/// <returns></returns>
public virtual async Task<TDocument> GetAndUpdateOne<TDocument>(
FilterDefinition<TDocument> filter,
UpdateDefinition<TDocument> update,
FindOneAndUpdateOptions<TDocument, TDocument> options)
where TDocument : IDocument
{
return await GetCollection<TDocument>().FindOneAndUpdateAsync(filter, update, options);
}
/// <summary>
/// GetAndUpdateOne with filter
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="update"></param>
/// <param name="options"></param>
/// <returns></returns>
public virtual async Task<TDocument> GetAndUpdateOne<TDocument, TKey>(
FilterDefinition<TDocument> filter,
UpdateDefinition<TDocument> update,
FindOneAndUpdateOptions<TDocument, TDocument> options)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>
{
return await GetCollection<TDocument, TKey>().FindOneAndUpdateAsync(filter, update, options);
}
#endregion Find And Update
} }
} }
File diff suppressed because it is too large Load Diff
@@ -11,12 +11,12 @@ using MongoDbGenericRepository.Models;
namespace MongoDbGenericRepository.DataAccess.Read namespace MongoDbGenericRepository.DataAccess.Read
{ {
/// <summary> /// <summary>
/// A interface for accessing the Database and its Collections. /// A interface for accessing the Database and its Collections.
/// </summary> /// </summary>
public interface IMongoDbReader : IDataAccessBase public interface IMongoDbReader : IDataAccessBase
{ {
/// <summary> /// <summary>
/// Asynchronously returns a projected document matching the filter condition. /// Asynchronously returns a projected document matching the filter condition.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -35,7 +35,7 @@ namespace MongoDbGenericRepository.DataAccess.Read
where TProjection : class; where TProjection : class;
/// <summary> /// <summary>
/// Returns a projected document matching the filter condition. /// Returns a projected document matching the filter condition.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -43,13 +43,18 @@ namespace MongoDbGenericRepository.DataAccess.Read
/// <param name="filter">A LINQ expression filter.</param> /// <param name="filter">A LINQ expression filter.</param>
/// <param name="projection">The projection expression.</param> /// <param name="projection">The projection expression.</param>
/// <param name="partitionKey">An optional partition key.</param> /// <param name="partitionKey">An optional partition key.</param>
TProjection ProjectOne<TDocument, TProjection, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TProjection>> projection, string partitionKey = null, CancellationToken cancellationToken = default) /// <param name="cancellationToken">The cancellation token.</param>
TProjection ProjectOne<TDocument, TProjection, TKey>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TProjection>> projection,
string partitionKey = null,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey> where TKey : IEquatable<TKey>
where TProjection : class; where TProjection : class;
/// <summary> /// <summary>
/// Asynchronously returns a list of projected documents matching the filter condition. /// Asynchronously returns a list of projected documents matching the filter condition.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -68,7 +73,7 @@ namespace MongoDbGenericRepository.DataAccess.Read
where TProjection : class; where TProjection : class;
/// <summary> /// <summary>
/// Asynchronously returns a list of projected documents matching the filter condition. /// Asynchronously returns a list of projected documents matching the filter condition.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -76,14 +81,19 @@ namespace MongoDbGenericRepository.DataAccess.Read
/// <param name="filter">The document filter.</param> /// <param name="filter">The document filter.</param>
/// <param name="projection">The projection expression.</param> /// <param name="projection">The projection expression.</param>
/// <param name="partitionKey">An optional partition key.</param> /// <param name="partitionKey">An optional partition key.</param>
List<TProjection> ProjectMany<TDocument, TProjection, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TProjection>> projection, string partitionKey = null, CancellationToken cancellationToken = default) /// <param name="cancellationToken">The cancellation token.</param>
List<TProjection> ProjectMany<TDocument, TProjection, TKey>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TProjection>> projection,
string partitionKey = null,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey> where TKey : IEquatable<TKey>
where TProjection : class; where TProjection : class;
/// <summary> /// <summary>
/// Groups a collection of documents given a grouping criteria, /// Groups a collection of documents given a grouping criteria,
/// and returns a dictionary of listed document groups with keys having the different values of the grouping criteria. /// and returns a dictionary of listed document groups with keys having the different values of the grouping criteria.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -92,17 +102,19 @@ namespace MongoDbGenericRepository.DataAccess.Read
/// <param name="groupingCriteria">The grouping criteria.</param> /// <param name="groupingCriteria">The grouping criteria.</param>
/// <param name="groupProjection">The projected group result.</param> /// <param name="groupProjection">The projected group result.</param>
/// <param name="partitionKey">The partition key of your document, if any.</param> /// <param name="partitionKey">The partition key of your document, if any.</param>
/// <param name="cancellationToken">The cancellation token.</param>
List<TProjection> GroupBy<TDocument, TGroupKey, TProjection, TKey>( List<TProjection> GroupBy<TDocument, TGroupKey, TProjection, TKey>(
Expression<Func<TDocument, TGroupKey>> groupingCriteria, Expression<Func<TDocument, TGroupKey>> groupingCriteria,
Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection, Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection,
string partitionKey = null, CancellationToken cancellationToken = default) string partitionKey = null,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey> where TKey : IEquatable<TKey>
where TProjection : class, new(); where TProjection : class, new();
/// <summary> /// <summary>
/// Groups filtered a collection of documents given a grouping criteria, /// Groups filtered a collection of documents given a grouping criteria,
/// and returns a dictionary of listed document groups with keys having the different values of the grouping criteria. /// and returns a dictionary of listed document groups with keys having the different values of the grouping criteria.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -112,18 +124,20 @@ namespace MongoDbGenericRepository.DataAccess.Read
/// <param name="selector">The grouping criteria.</param> /// <param name="selector">The grouping criteria.</param>
/// <param name="projection">The projected group result.</param> /// <param name="projection">The projected group result.</param>
/// <param name="partitionKey">The partition key of your document, if any.</param> /// <param name="partitionKey">The partition key of your document, if any.</param>
/// <param name="cancellationToken">The cancellation token.</param>
List<TProjection> GroupBy<TDocument, TGroupKey, TProjection, TKey>( List<TProjection> GroupBy<TDocument, TGroupKey, TProjection, TKey>(
Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TGroupKey>> selector, Expression<Func<TDocument, TGroupKey>> selector,
Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> projection, Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> projection,
string partitionKey = null, CancellationToken cancellationToken = default) string partitionKey = null,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey> where TKey : IEquatable<TKey>
where TProjection : class, new(); where TProjection : class, new();
/// <summary> /// <summary>
/// Groups filtered a collection of documents given a grouping criteria, /// Groups filtered a collection of documents given a grouping criteria,
/// and returns a dictionary of listed document groups with keys having the different values of the grouping criteria. /// and returns a dictionary of listed document groups with keys having the different values of the grouping criteria.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -145,7 +159,7 @@ namespace MongoDbGenericRepository.DataAccess.Read
where TProjection : class, new(); where TProjection : class, new();
/// <summary> /// <summary>
/// Asynchronously returns a paginated list of the documents matching the filter condition. /// Asynchronously returns a paginated list of the documents matching the filter condition.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -168,7 +182,7 @@ namespace MongoDbGenericRepository.DataAccess.Read
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Asynchronously returns a paginated list of the documents matching the filter condition. /// Asynchronously returns a paginated list of the documents matching the filter condition.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -189,7 +203,7 @@ namespace MongoDbGenericRepository.DataAccess.Read
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Asynchronously returns one document given its id. /// Asynchronously returns one document given its id.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -201,18 +215,19 @@ namespace MongoDbGenericRepository.DataAccess.Read
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Returns one document given its id. /// Returns one document given its id.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <param name="id">The Id of the document you want to get.</param> /// <param name="id">The Id of the document you want to get.</param>
/// <param name="partitionKey">An optional partition key.</param> /// <param name="partitionKey">An optional partition key.</param>
/// <param name="cancellationToken">The cancellation token.</param>
TDocument GetById<TDocument, TKey>(TKey id, string partitionKey = null, CancellationToken cancellationToken = default) TDocument GetById<TDocument, TKey>(TKey id, string partitionKey = null, CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Asynchronously returns one document given filter definition. /// Asynchronously returns one document given filter definition.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -220,49 +235,60 @@ namespace MongoDbGenericRepository.DataAccess.Read
/// <param name="findOption">A mongodb filter option.</param> /// <param name="findOption">A mongodb filter option.</param>
/// <param name="partitionKey">An optional partition key.</param> /// <param name="partitionKey">An optional partition key.</param>
/// <param name="cancellationToken">An optional cancellation Token.</param> /// <param name="cancellationToken">An optional cancellation Token.</param>
Task<TDocument> GetOneAsync<TDocument, TKey>(FilterDefinition<TDocument> condition, FindOptions findOption = null, Task<TDocument> GetOneAsync<TDocument, TKey>(
FilterDefinition<TDocument> condition,
FindOptions findOption = null,
string partitionKey = null, string partitionKey = null,
CancellationToken cancellationToken = default) CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Asynchronously returns one document given an expression filter. /// Asynchronously returns one document given an expression filter.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <param name="filter">A LINQ expression filter.</param> /// <param name="filter">A LINQ expression filter.</param>
/// <param name="partitionKey">An optional partition key.</param> /// <param name="partitionKey">An optional partition key.</param>
/// <param name="cancellationToken">An optional cancellation Token.</param> /// <param name="cancellationToken">An optional cancellation Token.</param>
Task<TDocument> GetOneAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, string partitionKey = null, CancellationToken cancellationToken = default) Task<TDocument> GetOneAsync<TDocument, TKey>(
Expression<Func<TDocument, bool>> filter,
string partitionKey = null,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Returns one document given filter definition. /// Returns one document given filter definition.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <param name="condition">A mongodb filter definition.</param> /// <param name="condition">A mongodb filter definition.</param>
/// <param name="findOption">A mongodb filter option.</param> /// <param name="findOption">A mongodb filter option.</param>
/// <param name="partitionKey">An optional partition key.</param> /// <param name="partitionKey">An optional partition key.</param>
TDocument GetOne<TDocument, TKey>(FilterDefinition<TDocument> condition, FindOptions findOption = null, string partitionKey = null, CancellationToken cancellationToken = default) /// <param name="cancellationToken">The cancellation token.</param>
TDocument GetOne<TDocument, TKey>(
FilterDefinition<TDocument> condition,
FindOptions findOption = null,
string partitionKey = null,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Returns one document given an expression filter. /// Returns one document given an expression filter.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <param name="filter">A LINQ expression filter.</param> /// <param name="filter">A LINQ expression filter.</param>
/// <param name="partitionKey">An optional partition key.</param> /// <param name="partitionKey">An optional partition key.</param>
/// <param name="cancellationToken">The cancellation token.</param>
TDocument GetOne<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, string partitionKey = null, CancellationToken cancellationToken = default) TDocument GetOne<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, string partitionKey = null, CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Returns a collection cursor. /// Returns a collection cursor.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -273,7 +299,7 @@ namespace MongoDbGenericRepository.DataAccess.Read
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Returns true if any of the document of the collection matches the filter condition. /// Returns true if any of the document of the collection matches the filter condition.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -281,49 +307,60 @@ namespace MongoDbGenericRepository.DataAccess.Read
/// <param name="countOption">A mongodb counting option.</param> /// <param name="countOption">A mongodb counting option.</param>
/// <param name="partitionKey">An optional partition key.</param> /// <param name="partitionKey">An optional partition key.</param>
/// <param name="cancellationToken">An optional cancellation Token.</param> /// <param name="cancellationToken">An optional cancellation Token.</param>
Task<bool> AnyAsync<TDocument, TKey>(FilterDefinition<TDocument> condition, CountOptions countOption = null, string partitionKey = null, Task<bool> AnyAsync<TDocument, TKey>(
FilterDefinition<TDocument> condition,
CountOptions countOption = null,
string partitionKey = null,
CancellationToken cancellationToken = default) CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Returns true if any of the document of the collection matches the filter condition. /// Returns true if any of the document of the collection matches the filter condition.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <param name="filter">A LINQ expression filter.</param> /// <param name="filter">A LINQ expression filter.</param>
/// <param name="partitionKey">An optional partition key.</param> /// <param name="partitionKey">An optional partition key.</param>
/// <param name="cancellationToken">An optional cancellation Token.</param> /// <param name="cancellationToken">An optional cancellation Token.</param>
Task<bool> AnyAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, string partitionKey = null, CancellationToken cancellationToken = default) Task<bool> AnyAsync<TDocument, TKey>(
Expression<Func<TDocument, bool>> filter,
string partitionKey = null,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Returns true if any of the document of the collection matches the filter condition. /// Returns true if any of the document of the collection matches the filter condition.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <param name="condition">A mongodb filter definition.</param> /// <param name="condition">A mongodb filter definition.</param>
/// <param name="countOption">A mongodb counting option.</param> /// <param name="countOption">A mongodb counting option.</param>
/// <param name="partitionKey">An optional partition key.</param> /// <param name="partitionKey">An optional partition key.</param>
bool Any<TDocument, TKey>(FilterDefinition<TDocument> condition, CountOptions countOption = null, /// <param name="cancellationToken">The cancellation token.</param>
string partitionKey = null, CancellationToken cancellationToken = default) bool Any<TDocument, TKey>(
FilterDefinition<TDocument> condition,
CountOptions countOption = null,
string partitionKey = null,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Returns true if any of the document of the collection matches the filter condition. /// Returns true if any of the document of the collection matches the filter condition.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <param name="filter">A LINQ expression filter.</param> /// <param name="filter">A LINQ expression filter.</param>
/// <param name="partitionKey">An optional partition key.</param> /// <param name="partitionKey">An optional partition key.</param>
/// <param name="cancellationToken">The cancellation token.</param>
bool Any<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, string partitionKey = null, CancellationToken cancellationToken = default) bool Any<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, string partitionKey = null, CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Asynchronously returns a list of the documents matching the filter condition. /// Asynchronously returns a list of the documents matching the filter condition.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -331,49 +368,63 @@ namespace MongoDbGenericRepository.DataAccess.Read
/// <param name="findOption">A mongodb filter option.</param> /// <param name="findOption">A mongodb filter option.</param>
/// <param name="partitionKey">An optional partition key.</param> /// <param name="partitionKey">An optional partition key.</param>
/// <param name="cancellationToken">An optional cancellation Token.</param> /// <param name="cancellationToken">An optional cancellation Token.</param>
Task<List<TDocument>> GetAllAsync<TDocument, TKey>(FilterDefinition<TDocument> condition, Task<List<TDocument>> GetAllAsync<TDocument, TKey>(
FindOptions findOption = null, string partitionKey = null, CancellationToken cancellationToken = default) FilterDefinition<TDocument> condition,
FindOptions findOption = null,
string partitionKey = null,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Asynchronously returns a list of the documents matching the filter condition. /// Asynchronously returns a list of the documents matching the filter condition.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <param name="filter">A LINQ expression filter.</param> /// <param name="filter">A LINQ expression filter.</param>
/// <param name="partitionKey">An optional partition key.</param> /// <param name="partitionKey">An optional partition key.</param>
/// <param name="cancellationToken">An optional cancellation Token.</param> /// <param name="cancellationToken">An optional cancellation Token.</param>
Task<List<TDocument>> GetAllAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, string partitionKey = null, CancellationToken cancellationToken = default) Task<List<TDocument>> GetAllAsync<TDocument, TKey>(
Expression<Func<TDocument, bool>> filter,
string partitionKey = null,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Returns a list of the documents matching the filter condition. /// Returns a list of the documents matching the filter condition.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <param name="condition">A mongodb filter definition.</param> /// <param name="condition">A mongodb filter definition.</param>
/// <param name="findOption">A mongodb filter option.</param> /// <param name="findOption">A mongodb filter option.</param>
/// <param name="partitionKey">An optional partition key.</param> /// <param name="partitionKey">An optional partition key.</param>
List<TDocument> GetAll<TDocument, TKey>(FilterDefinition<TDocument> condition, FindOptions findOption = null, /// <param name="cancellationToken">The cancellation token.</param>
string partitionKey = null, CancellationToken cancellationToken = default) List<TDocument> GetAll<TDocument, TKey>(
FilterDefinition<TDocument> condition,
FindOptions findOption = null,
string partitionKey = null,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Returns a list of the documents matching the filter condition. /// Returns a list of the documents matching the filter condition.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <param name="filter">A LINQ expression filter.</param> /// <param name="filter">A LINQ expression filter.</param>
/// <param name="partitionKey">An optional partition key.</param> /// <param name="partitionKey">An optional partition key.</param>
List<TDocument> GetAll<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, string partitionKey = null, CancellationToken cancellationToken = default) /// <param name="cancellationToken">The cancellation token.</param>
List<TDocument> GetAll<TDocument, TKey>(
Expression<Func<TDocument, bool>> filter,
string partitionKey = null,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Asynchronously counts how many documents match the filter condition. /// Asynchronously counts how many documents match the filter condition.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -381,49 +432,61 @@ namespace MongoDbGenericRepository.DataAccess.Read
/// <param name="countOption">A mongodb counting option.</param> /// <param name="countOption">A mongodb counting option.</param>
/// <param name="partitionKey">An optional partitionKey</param> /// <param name="partitionKey">An optional partitionKey</param>
/// <param name="cancellationToken">An optional cancellation Token.</param> /// <param name="cancellationToken">An optional cancellation Token.</param>
Task<long> CountAsync<TDocument, TKey>(FilterDefinition<TDocument> condition, CountOptions countOption = null, Task<long> CountAsync<TDocument, TKey>(
string partitionKey = null, CancellationToken cancellationToken = default) FilterDefinition<TDocument> condition,
CountOptions countOption = null,
string partitionKey = null,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Asynchronously counts how many documents match the filter condition. /// Asynchronously counts how many documents match the filter condition.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <param name="filter">A LINQ expression filter.</param> /// <param name="filter">A LINQ expression filter.</param>
/// <param name="partitionKey">An optional partitionKey</param> /// <param name="partitionKey">An optional partitionKey</param>
/// <param name="cancellationToken">An optional cancellation Token.</param> /// <param name="cancellationToken">An optional cancellation Token.</param>
Task<long> CountAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, string partitionKey = null, CancellationToken cancellationToken = default) Task<long> CountAsync<TDocument, TKey>(
Expression<Func<TDocument, bool>> filter,
string partitionKey = null,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Counts how many documents match the filter condition. /// Counts how many documents match the filter condition.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <param name="condition">A mongodb filter definition.</param> /// <param name="condition">A mongodb filter definition.</param>
/// <param name="countOption">A mongodb counting option.</param> /// <param name="countOption">A mongodb counting option.</param>
/// <param name="partitionKey">An optional partitionKey</param> /// <param name="partitionKey">An optional partitionKey</param>
long Count<TDocument, TKey>(FilterDefinition<TDocument> condition, CountOptions countOption = null, /// <param name="cancellationToken">The cancellation token.</param>
string partitionKey = null, CancellationToken cancellationToken = default) long Count<TDocument, TKey>(
FilterDefinition<TDocument> condition,
CountOptions countOption = null,
string partitionKey = null,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Counts how many documents match the filter condition. /// Counts how many documents match the filter condition.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <param name="filter">A LINQ expression filter.</param> /// <param name="filter">A LINQ expression filter.</param>
/// <param name="partitionKey">An optional partitionKey</param> /// <param name="partitionKey">An optional partitionKey</param>
/// <param name="cancellationToken">The cancellation token.</param>
long Count<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, string partitionKey = null, CancellationToken cancellationToken = default) long Count<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, string partitionKey = null, CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the filter. /// Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the
/// filter.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The document type.</typeparam> /// <typeparam name="TDocument">The document type.</typeparam>
/// <typeparam name="TKey">The type of the primary key.</typeparam> /// <typeparam name="TKey">The type of the primary key.</typeparam>
@@ -431,24 +494,35 @@ namespace MongoDbGenericRepository.DataAccess.Read
/// <param name="maxValueSelector">A property selector to order by descending.</param> /// <param name="maxValueSelector">A property selector to order by descending.</param>
/// <param name="partitionKey">An optional partitionKey.</param> /// <param name="partitionKey">An optional partitionKey.</param>
/// <param name="cancellationToken">An optional cancellation Token.</param> /// <param name="cancellationToken">An optional cancellation Token.</param>
Task<TDocument> GetByMaxAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, object>> maxValueSelector, string partitionKey = null, CancellationToken cancellationToken = default) Task<TDocument> GetByMaxAsync<TDocument, TKey>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, object>> maxValueSelector,
string partitionKey = null,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the filter. /// Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the
/// filter.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The document type.</typeparam> /// <typeparam name="TDocument">The document type.</typeparam>
/// <typeparam name="TKey">The type of the primary key.</typeparam> /// <typeparam name="TKey">The type of the primary key.</typeparam>
/// <param name="filter">A LINQ expression filter.</param> /// <param name="filter">A LINQ expression filter.</param>
/// <param name="maxValueSelector">A property selector to order by descending.</param> /// <param name="maxValueSelector">A property selector to order by descending.</param>
/// <param name="partitionKey">An optional partitionKey.</param> /// <param name="partitionKey">An optional partitionKey.</param>
TDocument GetByMax<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, object>> maxValueSelector, string partitionKey = null, CancellationToken cancellationToken = default) /// <param name="cancellationToken">The cancellation token.</param>
TDocument GetByMax<TDocument, TKey>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, object>> maxValueSelector,
string partitionKey = null,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Gets the document with the minimum value of a specified property in a MongoDB collections that is satisfying the filter. /// Gets the document with the minimum value of a specified property in a MongoDB collections that is satisfying the
/// filter.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The document type.</typeparam> /// <typeparam name="TDocument">The document type.</typeparam>
/// <typeparam name="TKey">The type of the primary key.</typeparam> /// <typeparam name="TKey">The type of the primary key.</typeparam>
@@ -456,24 +530,34 @@ namespace MongoDbGenericRepository.DataAccess.Read
/// <param name="minValueSelector">A property selector to order by ascending.</param> /// <param name="minValueSelector">A property selector to order by ascending.</param>
/// <param name="partitionKey">An optional partitionKey.</param> /// <param name="partitionKey">An optional partitionKey.</param>
/// <param name="cancellationToken">An optional cancellation Token.</param> /// <param name="cancellationToken">An optional cancellation Token.</param>
Task<TDocument> GetByMinAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, object>> minValueSelector, string partitionKey = null, CancellationToken cancellationToken = default) Task<TDocument> GetByMinAsync<TDocument, TKey>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, object>> minValueSelector,
string partitionKey = null,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Gets the document with the minimum value of a specified property in a MongoDB collections that is satisfying the filter. /// Gets the document with the minimum value of a specified property in a MongoDB collections that is satisfying the
/// filter.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The document type.</typeparam> /// <typeparam name="TDocument">The document type.</typeparam>
/// <typeparam name="TKey">The type of the primary key.</typeparam> /// <typeparam name="TKey">The type of the primary key.</typeparam>
/// <param name="filter">A LINQ expression filter.</param> /// <param name="filter">A LINQ expression filter.</param>
/// <param name="minValueSelector">A property selector to order by ascending.</param> /// <param name="minValueSelector">A property selector to order by ascending.</param>
/// <param name="partitionKey">An optional partitionKey.</param> /// <param name="partitionKey">An optional partitionKey.</param>
TDocument GetByMin<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, object>> minValueSelector, string partitionKey = null, CancellationToken cancellationToken = default) /// <param name="cancellationToken">The cancellation token.</param>
TDocument GetByMin<TDocument, TKey>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, object>> minValueSelector,
string partitionKey = null,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Gets the maximum value of a property in a mongodb collections that is satisfying the filter. /// Gets the maximum value of a property in a mongodb collections that is satisfying the filter.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The document type.</typeparam> /// <typeparam name="TDocument">The document type.</typeparam>
/// <typeparam name="TKey">The type of the primary key.</typeparam> /// <typeparam name="TKey">The type of the primary key.</typeparam>
@@ -482,12 +566,16 @@ namespace MongoDbGenericRepository.DataAccess.Read
/// <param name="maxValueSelector">A property selector to order by ascending.</param> /// <param name="maxValueSelector">A property selector to order by ascending.</param>
/// <param name="partitionKey">An optional partitionKey.</param> /// <param name="partitionKey">An optional partitionKey.</param>
/// <param name="cancellationToken">An optional cancellation Token.</param> /// <param name="cancellationToken">An optional cancellation Token.</param>
Task<TValue> GetMaxValueAsync<TDocument, TKey, TValue>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TValue>> maxValueSelector, string partitionKey = null, CancellationToken cancellationToken = default) Task<TValue> GetMaxValueAsync<TDocument, TKey, TValue>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TValue>> maxValueSelector,
string partitionKey = null,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Gets the maximum value of a property in a mongodb collections that is satisfying the filter. /// Gets the maximum value of a property in a mongodb collections that is satisfying the filter.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The document type.</typeparam> /// <typeparam name="TDocument">The document type.</typeparam>
/// <typeparam name="TKey">The type of the primary key.</typeparam> /// <typeparam name="TKey">The type of the primary key.</typeparam>
@@ -495,12 +583,17 @@ namespace MongoDbGenericRepository.DataAccess.Read
/// <param name="filter">A LINQ expression filter.</param> /// <param name="filter">A LINQ expression filter.</param>
/// <param name="maxValueSelector">A property selector to order by ascending.</param> /// <param name="maxValueSelector">A property selector to order by ascending.</param>
/// <param name="partitionKey">An optional partitionKey.</param> /// <param name="partitionKey">An optional partitionKey.</param>
TValue GetMaxValue<TDocument, TKey, TValue>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TValue>> maxValueSelector, string partitionKey = null, CancellationToken cancellationToken = default) /// <param name="cancellationToken">The cancellation token.</param>
TValue GetMaxValue<TDocument, TKey, TValue>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TValue>> maxValueSelector,
string partitionKey = null,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Gets the minimum value of a property in a mongodb collections that is satisfying the filter. /// Gets the minimum value of a property in a mongodb collections that is satisfying the filter.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The document type.</typeparam> /// <typeparam name="TDocument">The document type.</typeparam>
/// <typeparam name="TKey">The type of the primary key.</typeparam> /// <typeparam name="TKey">The type of the primary key.</typeparam>
@@ -509,12 +602,16 @@ namespace MongoDbGenericRepository.DataAccess.Read
/// <param name="minValueSelector">A property selector to order by ascending.</param> /// <param name="minValueSelector">A property selector to order by ascending.</param>
/// <param name="partitionKey">An optional partition key.</param> /// <param name="partitionKey">An optional partition key.</param>
/// <param name="cancellationToken">An optional cancellation Token.</param> /// <param name="cancellationToken">An optional cancellation Token.</param>
Task<TValue> GetMinValueAsync<TDocument, TKey, TValue>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TValue>> minValueSelector, string partitionKey = null, CancellationToken cancellationToken = default) Task<TValue> GetMinValueAsync<TDocument, TKey, TValue>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TValue>> minValueSelector,
string partitionKey = null,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Gets the minimum value of a property in a mongodb collections that is satisfying the filter. /// Gets the minimum value of a property in a mongodb collections that is satisfying the filter.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The document type.</typeparam> /// <typeparam name="TDocument">The document type.</typeparam>
/// <typeparam name="TKey">The type of the primary key.</typeparam> /// <typeparam name="TKey">The type of the primary key.</typeparam>
@@ -522,12 +619,17 @@ namespace MongoDbGenericRepository.DataAccess.Read
/// <param name="filter">A LINQ expression filter.</param> /// <param name="filter">A LINQ expression filter.</param>
/// <param name="minValueSelector">A property selector to order by ascending.</param> /// <param name="minValueSelector">A property selector to order by ascending.</param>
/// <param name="partitionKey">An optional partition key.</param> /// <param name="partitionKey">An optional partition key.</param>
TValue GetMinValue<TDocument, TKey, TValue>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TValue>> minValueSelector, string partitionKey = null, CancellationToken cancellationToken = default) /// <param name="cancellationToken">The cancellation token.</param>
TValue GetMinValue<TDocument, TKey, TValue>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TValue>> minValueSelector,
string partitionKey = null,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Sums the values of a selected field for a given filtered collection of documents. /// Sums the values of a selected field for a given filtered collection of documents.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -535,7 +637,8 @@ namespace MongoDbGenericRepository.DataAccess.Read
/// <param name="selector">The field you want to sum.</param> /// <param name="selector">The field you want to sum.</param>
/// <param name="partitionKey">The partition key of your document, if any.</param> /// <param name="partitionKey">The partition key of your document, if any.</param>
/// <param name="cancellationToken">An optional cancellation Token.</param> /// <param name="cancellationToken">An optional cancellation Token.</param>
Task<int> SumByAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, Task<int> SumByAsync<TDocument, TKey>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, int>> selector, Expression<Func<TDocument, int>> selector,
string partitionKey = null, string partitionKey = null,
CancellationToken cancellationToken = default) CancellationToken cancellationToken = default)
@@ -543,7 +646,7 @@ namespace MongoDbGenericRepository.DataAccess.Read
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Sums the values of a selected field for a given filtered collection of documents. /// Sums the values of a selected field for a given filtered collection of documents.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -551,35 +654,39 @@ namespace MongoDbGenericRepository.DataAccess.Read
/// <param name="selector">The field you want to sum.</param> /// <param name="selector">The field you want to sum.</param>
/// <param name="partitionKey">The partition key of your document, if any.</param> /// <param name="partitionKey">The partition key of your document, if any.</param>
/// <param name="cancellationToken">An optional cancellation Token.</param> /// <param name="cancellationToken">An optional cancellation Token.</param>
Task<decimal> SumByAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, Task<decimal> SumByAsync<TDocument, TKey>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, decimal>> selector, Expression<Func<TDocument, decimal>> selector,
string partitionKey = null, CancellationToken cancellationToken = default) string partitionKey = null,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Sums the values of a selected field for a given filtered collection of documents. /// Sums the values of a selected field for a given filtered collection of documents.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <param name="filter">A LINQ expression filter.</param> /// <param name="filter">A LINQ expression filter.</param>
/// <param name="selector">The field you want to sum.</param> /// <param name="selector">The field you want to sum.</param>
/// <param name="partitionKey">The partition key of your document, if any.</param> /// <param name="partitionKey">The partition key of your document, if any.</param>
int SumBy<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, int SumBy<TDocument, TKey>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, int>> selector, Expression<Func<TDocument, int>> selector,
string partitionKey = null) string partitionKey = null)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Sums the values of a selected field for a given filtered collection of documents. /// Sums the values of a selected field for a given filtered collection of documents.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <param name="filter">A LINQ expression filter.</param> /// <param name="filter">A LINQ expression filter.</param>
/// <param name="selector">The field you want to sum.</param> /// <param name="selector">The field you want to sum.</param>
/// <param name="partitionKey">The partition key of your document, if any.</param> /// <param name="partitionKey">The partition key of your document, if any.</param>
decimal SumBy<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, decimal SumBy<TDocument, TKey>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, decimal>> selector, Expression<Func<TDocument, decimal>> selector,
string partitionKey = null) string partitionKey = null)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
@@ -15,7 +15,8 @@ namespace MongoDbGenericRepository.DataAccess.Read
public virtual List<TProjection> GroupBy<TDocument, TGroupKey, TProjection, TKey>( public virtual List<TProjection> GroupBy<TDocument, TGroupKey, TProjection, TKey>(
Expression<Func<TDocument, TGroupKey>> groupingCriteria, Expression<Func<TDocument, TGroupKey>> groupingCriteria,
Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection, Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection,
string partitionKey = null, CancellationToken cancellationToken = default) string partitionKey = null,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey> where TKey : IEquatable<TKey>
where TProjection : class, new() where TProjection : class, new()
@@ -23,7 +24,7 @@ namespace MongoDbGenericRepository.DataAccess.Read
return HandlePartitioned<TDocument, TKey>(partitionKey) return HandlePartitioned<TDocument, TKey>(partitionKey)
.Aggregate() .Aggregate()
.Group(groupingCriteria, groupProjection) .Group(groupingCriteria, groupProjection)
.ToList(cancellationToken:cancellationToken); .ToList(cancellationToken);
} }
/// <inheritdoc /> /// <inheritdoc />
@@ -9,12 +9,12 @@ using MongoDbGenericRepository.Models;
namespace MongoDbGenericRepository.DataAccess.Update namespace MongoDbGenericRepository.DataAccess.Update
{ {
/// <summary> /// <summary>
/// A interface for updating documents in MongoDb. /// A interface for updating documents in MongoDb.
/// </summary> /// </summary>
public interface IMongoDbUpdater : IDataAccessBase public interface IMongoDbUpdater : IDataAccessBase
{ {
/// <summary> /// <summary>
/// Asynchronously Updates a document. /// Asynchronously Updates a document.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -25,19 +25,22 @@ namespace MongoDbGenericRepository.DataAccess.Update
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Takes a document you want to modify and applies the update you have defined in MongoDb. /// Takes a document you want to modify and applies the update you have defined in MongoDb.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <param name="documentToModify">The document you want to modify.</param> /// <param name="documentToModify">The document you want to modify.</param>
/// <param name="update">The update definition for the document.</param> /// <param name="update">The update definition for the document.</param>
/// <param name="cancellationToken">An optional cancellation token.</param> /// <param name="cancellationToken">An optional cancellation token.</param>
Task<bool> UpdateOneAsync<TDocument, TKey>(TDocument documentToModify, UpdateDefinition<TDocument> update, CancellationToken cancellationToken = default) Task<bool> UpdateOneAsync<TDocument, TKey>(
TDocument documentToModify,
UpdateDefinition<TDocument> update,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Updates the property field with the given value update a property field in entities. /// Updates the property field with the given value update a property field in entities.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -46,12 +49,16 @@ namespace MongoDbGenericRepository.DataAccess.Update
/// <param name="field">The field selector.</param> /// <param name="field">The field selector.</param>
/// <param name="value">The new value of the property field.</param> /// <param name="value">The new value of the property field.</param>
/// <param name="cancellationToken">An optional cancellation token.</param> /// <param name="cancellationToken">An optional cancellation token.</param>
Task<bool> UpdateOneAsync<TDocument, TKey, TField>(TDocument documentToModify, Expression<Func<TDocument, TField>> field, TField value, CancellationToken cancellationToken = default) Task<bool> UpdateOneAsync<TDocument, TKey, TField>(
TDocument documentToModify,
Expression<Func<TDocument, TField>> field,
TField value,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Updates the property field with the given value update a property field in entities. /// Updates the property field with the given value update a property field in entities.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -61,12 +68,17 @@ namespace MongoDbGenericRepository.DataAccess.Update
/// <param name="value">The new value of the property field.</param> /// <param name="value">The new value of the property field.</param>
/// <param name="partitionKey">The value of the partition key.</param> /// <param name="partitionKey">The value of the partition key.</param>
/// <param name="cancellationToken">An optional cancellation token.</param> /// <param name="cancellationToken">An optional cancellation token.</param>
Task<bool> UpdateOneAsync<TDocument, TKey, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey = null, CancellationToken cancellationToken = default) Task<bool> UpdateOneAsync<TDocument, TKey, TField>(
FilterDefinition<TDocument> filter,
Expression<Func<TDocument, TField>> field,
TField value,
string partitionKey = null,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// For the entity selected by the filter, updates the property field with the given value. /// For the entity selected by the filter, updates the property field with the given value.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -76,12 +88,17 @@ namespace MongoDbGenericRepository.DataAccess.Update
/// <param name="value">The new value of the property field.</param> /// <param name="value">The new value of the property field.</param>
/// <param name="partitionKey">The partition key for the document.</param> /// <param name="partitionKey">The partition key for the document.</param>
/// <param name="cancellationToken">An optional cancellation token.</param> /// <param name="cancellationToken">An optional cancellation token.</param>
Task<bool> UpdateOneAsync<TDocument, TKey, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey = null, CancellationToken cancellationToken = default) Task<bool> UpdateOneAsync<TDocument, TKey, TField>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TField>> field,
TField value,
string partitionKey = null,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Updates a document. /// Updates a document.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -94,7 +111,7 @@ namespace MongoDbGenericRepository.DataAccess.Update
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Updates a document. /// Updates a document.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -103,12 +120,16 @@ namespace MongoDbGenericRepository.DataAccess.Update
/// <param name="update">The update definition.</param> /// <param name="update">The update definition.</param>
/// <param name="cancellationToken">The optional cancellation token.</param> /// <param name="cancellationToken">The optional cancellation token.</param>
/// <returns></returns> /// <returns></returns>
Task<bool> UpdateOneAsync<TDocument, TKey>(IClientSessionHandle session, TDocument documentToModify, UpdateDefinition<TDocument> update, CancellationToken cancellationToken = default) Task<bool> UpdateOneAsync<TDocument, TKey>(
IClientSessionHandle session,
TDocument documentToModify,
UpdateDefinition<TDocument> update,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Updates a document. /// Updates a document.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -119,12 +140,17 @@ namespace MongoDbGenericRepository.DataAccess.Update
/// <param name="value">The value of the field.</param> /// <param name="value">The value of the field.</param>
/// <param name="cancellationToken">The optional cancellation token.</param> /// <param name="cancellationToken">The optional cancellation token.</param>
/// <returns></returns> /// <returns></returns>
Task<bool> UpdateOneAsync<TDocument, TKey, TField>(IClientSessionHandle session, TDocument documentToModify, Expression<Func<TDocument, TField>> field, TField value, CancellationToken cancellationToken = default) Task<bool> UpdateOneAsync<TDocument, TKey, TField>(
IClientSessionHandle session,
TDocument documentToModify,
Expression<Func<TDocument, TField>> field,
TField value,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Updates a document. /// Updates a document.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -136,12 +162,18 @@ namespace MongoDbGenericRepository.DataAccess.Update
/// <param name="partitionKey">The optional partition key.</param> /// <param name="partitionKey">The optional partition key.</param>
/// <param name="cancellationToken">The optional cancellation token.</param> /// <param name="cancellationToken">The optional cancellation token.</param>
/// <returns></returns> /// <returns></returns>
Task<bool> UpdateOneAsync<TDocument, TKey, TField>(IClientSessionHandle session, FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey = null, CancellationToken cancellationToken = default) Task<bool> UpdateOneAsync<TDocument, TKey, TField>(
IClientSessionHandle session,
FilterDefinition<TDocument> filter,
Expression<Func<TDocument, TField>> field,
TField value,
string partitionKey = null,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Updates a document. /// Updates a document.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -153,12 +185,18 @@ namespace MongoDbGenericRepository.DataAccess.Update
/// <param name="partitionKey">The optional partition key.</param> /// <param name="partitionKey">The optional partition key.</param>
/// <param name="cancellationToken">The optional cancellation token.</param> /// <param name="cancellationToken">The optional cancellation token.</param>
/// <returns></returns> /// <returns></returns>
Task<bool> UpdateOneAsync<TDocument, TKey, TField>(IClientSessionHandle session, Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey = null, CancellationToken cancellationToken = default) Task<bool> UpdateOneAsync<TDocument, TKey, TField>(
IClientSessionHandle session,
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TField>> field,
TField value,
string partitionKey = null,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Updates a document. /// Updates a document.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -169,7 +207,7 @@ namespace MongoDbGenericRepository.DataAccess.Update
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Takes a document you want to modify and applies the update you have defined in MongoDb. /// Takes a document you want to modify and applies the update you have defined in MongoDb.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -181,7 +219,7 @@ namespace MongoDbGenericRepository.DataAccess.Update
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Updates the property field with the given value update a property field in entities. /// Updates the property field with the given value update a property field in entities.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -190,12 +228,16 @@ namespace MongoDbGenericRepository.DataAccess.Update
/// <param name="field">The field selector.</param> /// <param name="field">The field selector.</param>
/// <param name="value">The new value of the property field.</param> /// <param name="value">The new value of the property field.</param>
/// <param name="cancellationToken">The optional cancellation token.</param> /// <param name="cancellationToken">The optional cancellation token.</param>
bool UpdateOne<TDocument, TKey, TField>(TDocument documentToModify, Expression<Func<TDocument, TField>> field, TField value, CancellationToken cancellationToken = default) bool UpdateOne<TDocument, TKey, TField>(
TDocument documentToModify,
Expression<Func<TDocument, TField>> field,
TField value,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Updates the property field with the given value. /// Updates the property field with the given value.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -205,12 +247,17 @@ namespace MongoDbGenericRepository.DataAccess.Update
/// <param name="value">The new value of the property field.</param> /// <param name="value">The new value of the property field.</param>
/// <param name="partitionKey">The value of the partition key.</param> /// <param name="partitionKey">The value of the partition key.</param>
/// <param name="cancellationToken">The optional cancellation token.</param> /// <param name="cancellationToken">The optional cancellation token.</param>
bool UpdateOne<TDocument, TKey, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey = null, CancellationToken cancellationToken = default) bool UpdateOne<TDocument, TKey, TField>(
FilterDefinition<TDocument> filter,
Expression<Func<TDocument, TField>> field,
TField value,
string partitionKey = null,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// For the entity selected by the filter, updates the property field with the given value. /// For the entity selected by the filter, updates the property field with the given value.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -220,12 +267,17 @@ namespace MongoDbGenericRepository.DataAccess.Update
/// <param name="value">The new value of the property field.</param> /// <param name="value">The new value of the property field.</param>
/// <param name="partitionKey">The partition key for the document.</param> /// <param name="partitionKey">The partition key for the document.</param>
/// <param name="cancellationToken">The optional cancellation token.</param> /// <param name="cancellationToken">The optional cancellation token.</param>
bool UpdateOne<TDocument, TKey, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey = null, CancellationToken cancellationToken = default) bool UpdateOne<TDocument, TKey, TField>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TField>> field,
TField value,
string partitionKey = null,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Updates a document. /// Updates a document.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -238,7 +290,7 @@ namespace MongoDbGenericRepository.DataAccess.Update
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Updates a document. /// Updates a document.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -247,12 +299,16 @@ namespace MongoDbGenericRepository.DataAccess.Update
/// <param name="update">The update definition.</param> /// <param name="update">The update definition.</param>
/// <param name="cancellationToken">The optional cancellation token.</param> /// <param name="cancellationToken">The optional cancellation token.</param>
/// <returns></returns> /// <returns></returns>
bool UpdateOne<TDocument, TKey>(IClientSessionHandle session, TDocument documentToModify, UpdateDefinition<TDocument> update, CancellationToken cancellationToken = default) bool UpdateOne<TDocument, TKey>(
IClientSessionHandle session,
TDocument documentToModify,
UpdateDefinition<TDocument> update,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Updates a document. /// Updates a document.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -263,12 +319,17 @@ namespace MongoDbGenericRepository.DataAccess.Update
/// <param name="value">The value of the field.</param> /// <param name="value">The value of the field.</param>
/// <param name="cancellationToken">The optional cancellation token.</param> /// <param name="cancellationToken">The optional cancellation token.</param>
/// <returns></returns> /// <returns></returns>
bool UpdateOne<TDocument, TKey, TField>(IClientSessionHandle session, TDocument documentToModify, Expression<Func<TDocument, TField>> field, TField value, CancellationToken cancellationToken = default) bool UpdateOne<TDocument, TKey, TField>(
IClientSessionHandle session,
TDocument documentToModify,
Expression<Func<TDocument, TField>> field,
TField value,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Updates a document. /// Updates a document.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -280,12 +341,18 @@ namespace MongoDbGenericRepository.DataAccess.Update
/// <param name="partitionKey">The optional partition key.</param> /// <param name="partitionKey">The optional partition key.</param>
/// <param name="cancellationToken">The optional cancellation token.</param> /// <param name="cancellationToken">The optional cancellation token.</param>
/// <returns></returns> /// <returns></returns>
bool UpdateOne<TDocument, TKey, TField>(IClientSessionHandle session, FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey = null, CancellationToken cancellationToken = default) bool UpdateOne<TDocument, TKey, TField>(
IClientSessionHandle session,
FilterDefinition<TDocument> filter,
Expression<Func<TDocument, TField>> field,
TField value,
string partitionKey = null,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Updates a document. /// Updates a document.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -297,12 +364,18 @@ namespace MongoDbGenericRepository.DataAccess.Update
/// <param name="partitionKey">The optional partition key.</param> /// <param name="partitionKey">The optional partition key.</param>
/// <param name="cancellationToken">The optional cancellation token.</param> /// <param name="cancellationToken">The optional cancellation token.</param>
/// <returns></returns> /// <returns></returns>
bool UpdateOne<TDocument, TKey, TField>(IClientSessionHandle session, Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey = null, CancellationToken cancellationToken = default) bool UpdateOne<TDocument, TKey, TField>(
IClientSessionHandle session,
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TField>> field,
TField value,
string partitionKey = null,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// For the entities selected by the filter, updates the property field with the given value. /// For the entities selected by the filter, updates the property field with the given value.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -312,12 +385,17 @@ namespace MongoDbGenericRepository.DataAccess.Update
/// <param name="value">The new value of the property field.</param> /// <param name="value">The new value of the property field.</param>
/// <param name="partitionKey">The partition key for the document.</param> /// <param name="partitionKey">The partition key for the document.</param>
/// <param name="cancellationToken">The optional cancellation token.</param> /// <param name="cancellationToken">The optional cancellation token.</param>
Task<long> UpdateManyAsync<TDocument, TKey, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey = null, CancellationToken cancellationToken = default) Task<long> UpdateManyAsync<TDocument, TKey, TField>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TField>> field,
TField value,
string partitionKey = null,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// For the entities selected by the filter, updates the property field with the given value. /// For the entities selected by the filter, updates the property field with the given value.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -327,12 +405,17 @@ namespace MongoDbGenericRepository.DataAccess.Update
/// <param name="value">The new value of the property field.</param> /// <param name="value">The new value of the property field.</param>
/// <param name="partitionKey">The value of the partition key.</param> /// <param name="partitionKey">The value of the partition key.</param>
/// <param name="cancellationToken">The optional cancellation token.</param> /// <param name="cancellationToken">The optional cancellation token.</param>
Task<long> UpdateManyAsync<TDocument, TKey, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey = null, CancellationToken cancellationToken = default) Task<long> UpdateManyAsync<TDocument, TKey, TField>(
FilterDefinition<TDocument> filter,
Expression<Func<TDocument, TField>> field,
TField value,
string partitionKey = null,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// For the entities selected by the filter, apply the update definition. /// For the entities selected by the filter, apply the update definition.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -340,12 +423,16 @@ namespace MongoDbGenericRepository.DataAccess.Update
/// <param name="update">the update definition</param> /// <param name="update">the update definition</param>
/// <param name="partitionKey">The value of the partition key.</param> /// <param name="partitionKey">The value of the partition key.</param>
/// <param name="cancellationToken">The optional cancellation token.</param> /// <param name="cancellationToken">The optional cancellation token.</param>
Task<long> UpdateManyAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, UpdateDefinition<TDocument> update, string partitionKey = null, CancellationToken cancellationToken = default) Task<long> UpdateManyAsync<TDocument, TKey>(
Expression<Func<TDocument, bool>> filter,
UpdateDefinition<TDocument> update,
string partitionKey = null,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// For the entities selected by the filter, apply the update definition. /// For the entities selected by the filter, apply the update definition.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -353,12 +440,16 @@ namespace MongoDbGenericRepository.DataAccess.Update
/// <param name="updateDefinition">The update definition.</param> /// <param name="updateDefinition">The update definition.</param>
/// <param name="partitionKey">The value of the partition key.</param> /// <param name="partitionKey">The value of the partition key.</param>
/// <param name="cancellationToken">The optional cancellation token.</param> /// <param name="cancellationToken">The optional cancellation token.</param>
Task<long> UpdateManyAsync<TDocument, TKey>(FilterDefinition<TDocument> filter, UpdateDefinition<TDocument> updateDefinition, string partitionKey = null, CancellationToken cancellationToken = default) Task<long> UpdateManyAsync<TDocument, TKey>(
FilterDefinition<TDocument> filter,
UpdateDefinition<TDocument> updateDefinition,
string partitionKey = null,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// For the entities selected by the filter, updates the property field with the given value. /// For the entities selected by the filter, updates the property field with the given value.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -368,12 +459,17 @@ namespace MongoDbGenericRepository.DataAccess.Update
/// <param name="value">The new value of the property field.</param> /// <param name="value">The new value of the property field.</param>
/// <param name="partitionKey">The partition key for the document.</param> /// <param name="partitionKey">The partition key for the document.</param>
/// <param name="cancellationToken">The optional cancellation token.</param> /// <param name="cancellationToken">The optional cancellation token.</param>
long UpdateMany<TDocument, TKey, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey = null, CancellationToken cancellationToken = default) long UpdateMany<TDocument, TKey, TField>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TField>> field,
TField value,
string partitionKey = null,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// For the entities selected by the filter, updates the property field with the given value. /// For the entities selected by the filter, updates the property field with the given value.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -383,12 +479,17 @@ namespace MongoDbGenericRepository.DataAccess.Update
/// <param name="value">The new value of the property field.</param> /// <param name="value">The new value of the property field.</param>
/// <param name="partitionKey">The value of the partition key.</param> /// <param name="partitionKey">The value of the partition key.</param>
/// <param name="cancellationToken">The optional cancellation token.</param> /// <param name="cancellationToken">The optional cancellation token.</param>
long UpdateMany<TDocument, TKey, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey = null, CancellationToken cancellationToken = default) long UpdateMany<TDocument, TKey, TField>(
FilterDefinition<TDocument> filter,
Expression<Func<TDocument, TField>> field,
TField value,
string partitionKey = null,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// For the entities selected by the filter, apply the update definition. /// For the entities selected by the filter, apply the update definition.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -396,7 +497,11 @@ namespace MongoDbGenericRepository.DataAccess.Update
/// <param name="updateDefinition">The update definition.</param> /// <param name="updateDefinition">The update definition.</param>
/// <param name="partitionKey">The value of the partition key.</param> /// <param name="partitionKey">The value of the partition key.</param>
/// <param name="cancellationToken">The optional cancellation token.</param> /// <param name="cancellationToken">The optional cancellation token.</param>
long UpdateMany<TDocument, TKey>(FilterDefinition<TDocument> filter, UpdateDefinition<TDocument> updateDefinition, string partitionKey = null, CancellationToken cancellationToken = default) long UpdateMany<TDocument, TKey>(
FilterDefinition<TDocument> filter,
UpdateDefinition<TDocument> updateDefinition,
string partitionKey = null,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
} }
@@ -1,23 +1,26 @@
using MongoDB.Driver; using System;
using MongoDbGenericRepository.Models;
using System;
using System.Linq.Expressions; using System.Linq.Expressions;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using MongoDB.Driver;
using MongoDbGenericRepository.Models;
namespace MongoDbGenericRepository.DataAccess.Update namespace MongoDbGenericRepository.DataAccess.Update
{ {
public partial class MongoDbUpdater public partial class MongoDbUpdater
{ {
/// <inheritdoc cref="IMongoDbUpdater" /> /// <inheritdoc cref="IMongoDbUpdater" />
public virtual async Task<bool> UpdateOneAsync<TDocument, TKey>(IClientSessionHandle session, TDocument modifiedDocument, CancellationToken cancellationToken = default) public virtual async Task<bool> UpdateOneAsync<TDocument, TKey>(
IClientSessionHandle session,
TDocument modifiedDocument,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey> where TKey : IEquatable<TKey>
{ {
var filter = Builders<TDocument>.Filter.Eq("Id", modifiedDocument.Id); var filter = Builders<TDocument>.Filter.Eq("Id", modifiedDocument.Id);
var updateRes = await HandlePartitioned<TDocument, TKey>(modifiedDocument) var updateRes = await HandlePartitioned<TDocument, TKey>(modifiedDocument)
.ReplaceOneAsync(session, filter, modifiedDocument, cancellationToken: cancellationToken) .ReplaceOneAsync(session, filter, modifiedDocument, cancellationToken: cancellationToken)
.ConfigureAwait(false); .ConfigureAwait(false);
return updateRes.ModifiedCount == 1; return updateRes.ModifiedCount == 1;
} }
@@ -27,22 +30,32 @@ namespace MongoDbGenericRepository.DataAccess.Update
where TKey : IEquatable<TKey> where TKey : IEquatable<TKey>
{ {
var filter = Builders<TDocument>.Filter.Eq("Id", modifiedDocument.Id); var filter = Builders<TDocument>.Filter.Eq("Id", modifiedDocument.Id);
var updateRes = HandlePartitioned<TDocument, TKey>(modifiedDocument).ReplaceOne(session, filter, modifiedDocument, cancellationToken: cancellationToken); var updateRes = HandlePartitioned<TDocument, TKey>(modifiedDocument)
.ReplaceOne(session, filter, modifiedDocument, cancellationToken: cancellationToken);
return updateRes.ModifiedCount == 1; return updateRes.ModifiedCount == 1;
} }
/// <inheritdoc cref="IMongoDbUpdater" /> /// <inheritdoc cref="IMongoDbUpdater" />
public virtual async Task<bool> UpdateOneAsync<TDocument, TKey>(IClientSessionHandle session, TDocument documentToModify, UpdateDefinition<TDocument> update, CancellationToken cancellationToken = default) public virtual async Task<bool> UpdateOneAsync<TDocument, TKey>(
IClientSessionHandle session,
TDocument documentToModify,
UpdateDefinition<TDocument> update,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey> where TKey : IEquatable<TKey>
{ {
var filter = Builders<TDocument>.Filter.Eq("Id", documentToModify.Id); var filter = Builders<TDocument>.Filter.Eq("Id", documentToModify.Id);
var updateRes = await HandlePartitioned<TDocument, TKey>(documentToModify).UpdateOneAsync(session, filter, update, null, cancellationToken).ConfigureAwait(false); var updateRes = await HandlePartitioned<TDocument, TKey>(documentToModify).UpdateOneAsync(session, filter, update, null, cancellationToken)
.ConfigureAwait(false);
return updateRes.ModifiedCount == 1; return updateRes.ModifiedCount == 1;
} }
/// <inheritdoc cref="IMongoDbUpdater" /> /// <inheritdoc cref="IMongoDbUpdater" />
public virtual bool UpdateOne<TDocument, TKey>(IClientSessionHandle session, TDocument documentToModify, UpdateDefinition<TDocument> update, CancellationToken cancellationToken = default) public virtual bool UpdateOne<TDocument, TKey>(
IClientSessionHandle session,
TDocument documentToModify,
UpdateDefinition<TDocument> update,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey> where TKey : IEquatable<TKey>
{ {
@@ -52,40 +65,67 @@ namespace MongoDbGenericRepository.DataAccess.Update
} }
/// <inheritdoc cref="IMongoDbUpdater" /> /// <inheritdoc cref="IMongoDbUpdater" />
public virtual async Task<bool> UpdateOneAsync<TDocument, TKey, TField>(IClientSessionHandle session, TDocument documentToModify, Expression<Func<TDocument, TField>> field, TField value, CancellationToken cancellationToken = default) public virtual async Task<bool> UpdateOneAsync<TDocument, TKey, TField>(
IClientSessionHandle session,
TDocument documentToModify,
Expression<Func<TDocument, TField>> field,
TField value,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey> where TKey : IEquatable<TKey>
{ {
var filter = Builders<TDocument>.Filter.Eq("Id", documentToModify.Id); var filter = Builders<TDocument>.Filter.Eq("Id", documentToModify.Id);
var updateRes = await HandlePartitioned<TDocument, TKey>(documentToModify) var updateRes = await HandlePartitioned<TDocument, TKey>(documentToModify)
.UpdateOneAsync(session, filter, Builders<TDocument>.Update.Set(field, value), cancellationToken: cancellationToken) .UpdateOneAsync(session, filter, Builders<TDocument>.Update.Set(field, value), cancellationToken: cancellationToken)
.ConfigureAwait(false); .ConfigureAwait(false);
return updateRes.ModifiedCount == 1; return updateRes.ModifiedCount == 1;
} }
/// <inheritdoc cref="IMongoDbUpdater" /> /// <inheritdoc cref="IMongoDbUpdater" />
public virtual bool UpdateOne<TDocument, TKey, TField>(IClientSessionHandle session, TDocument documentToModify, Expression<Func<TDocument, TField>> field, TField value, CancellationToken cancellationToken = default) public virtual bool UpdateOne<TDocument, TKey, TField>(
IClientSessionHandle session,
TDocument documentToModify,
Expression<Func<TDocument, TField>> field,
TField value,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey> where TKey : IEquatable<TKey>
{ {
var filter = Builders<TDocument>.Filter.Eq("Id", documentToModify.Id); var filter = Builders<TDocument>.Filter.Eq("Id", documentToModify.Id);
var updateRes = HandlePartitioned<TDocument, TKey>(documentToModify).UpdateOne(session, filter, Builders<TDocument>.Update.Set(field, value), cancellationToken: cancellationToken); var updateRes = HandlePartitioned<TDocument, TKey>(documentToModify).UpdateOne(
session,
filter,
Builders<TDocument>.Update.Set(field, value),
cancellationToken: cancellationToken);
return updateRes.ModifiedCount == 1; return updateRes.ModifiedCount == 1;
} }
/// <inheritdoc cref="IMongoDbUpdater" /> /// <inheritdoc cref="IMongoDbUpdater" />
public virtual async Task<bool> UpdateOneAsync<TDocument, TKey, TField>(IClientSessionHandle session, FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey = null, CancellationToken cancellationToken = default) public virtual async Task<bool> UpdateOneAsync<TDocument, TKey, TField>(
IClientSessionHandle session,
FilterDefinition<TDocument> filter,
Expression<Func<TDocument, TField>> field,
TField value,
string partitionKey = null,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey> where TKey : IEquatable<TKey>
{ {
var collection = string.IsNullOrEmpty(partitionKey) ? GetCollection<TDocument, TKey>() : GetCollection<TDocument, TKey>(partitionKey); var collection = string.IsNullOrEmpty(partitionKey) ? GetCollection<TDocument, TKey>() : GetCollection<TDocument, TKey>(partitionKey);
var updateRes = await collection.UpdateOneAsync(session, filter, Builders<TDocument>.Update.Set(field, value), cancellationToken: cancellationToken).ConfigureAwait(false); var updateRes = await collection.UpdateOneAsync(session, filter, Builders<TDocument>.Update.Set(field, value), cancellationToken: cancellationToken)
.ConfigureAwait(false);
return updateRes.ModifiedCount == 1; return updateRes.ModifiedCount == 1;
} }
/// <inheritdoc cref="IMongoDbUpdater" /> /// <inheritdoc cref="IMongoDbUpdater" />
public virtual Task<bool> UpdateOneAsync<TDocument, TKey, TField>(IClientSessionHandle session, Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey = null, CancellationToken cancellationToken = default) public virtual Task<bool> UpdateOneAsync<TDocument, TKey, TField>(
IClientSessionHandle session,
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TField>> field,
TField value,
string partitionKey = null,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey> where TKey : IEquatable<TKey>
{ {
@@ -93,7 +133,13 @@ namespace MongoDbGenericRepository.DataAccess.Update
} }
/// <inheritdoc cref="IMongoDbUpdater" /> /// <inheritdoc cref="IMongoDbUpdater" />
public virtual bool UpdateOne<TDocument, TKey, TField>(IClientSessionHandle session, FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey = null, CancellationToken cancellationToken = default) public virtual bool UpdateOne<TDocument, TKey, TField>(
IClientSessionHandle session,
FilterDefinition<TDocument> filter,
Expression<Func<TDocument, TField>> field,
TField value,
string partitionKey = null,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey> where TKey : IEquatable<TKey>
{ {
@@ -103,7 +149,13 @@ namespace MongoDbGenericRepository.DataAccess.Update
} }
/// <inheritdoc cref="IMongoDbUpdater" /> /// <inheritdoc cref="IMongoDbUpdater" />
public virtual bool UpdateOne<TDocument, TKey, TField>(IClientSessionHandle session, Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey = null, CancellationToken cancellationToken = default) public virtual bool UpdateOne<TDocument, TKey, TField>(
IClientSessionHandle session,
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TField>> field,
TField value,
string partitionKey = null,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey> where TKey : IEquatable<TKey>
{ {
@@ -56,7 +56,10 @@ namespace MongoDbGenericRepository.DataAccess.Update
} }
/// <inheritdoc cref="IMongoDbUpdater" /> /// <inheritdoc cref="IMongoDbUpdater" />
public virtual bool UpdateOne<TDocument, TKey>(TDocument documentToModify, UpdateDefinition<TDocument> update, CancellationToken cancellationToken = default) public virtual bool UpdateOne<TDocument, TKey>(
TDocument documentToModify,
UpdateDefinition<TDocument> update,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey> where TKey : IEquatable<TKey>
{ {
@@ -83,12 +86,19 @@ namespace MongoDbGenericRepository.DataAccess.Update
} }
/// <inheritdoc cref="IMongoDbUpdater" /> /// <inheritdoc cref="IMongoDbUpdater" />
public virtual bool UpdateOne<TDocument, TKey, TField>(TDocument documentToModify, Expression<Func<TDocument, TField>> field, TField value, CancellationToken cancellationToken = default) public virtual bool UpdateOne<TDocument, TKey, TField>(
TDocument documentToModify,
Expression<Func<TDocument, TField>> field,
TField value,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey> where TKey : IEquatable<TKey>
{ {
var filter = Builders<TDocument>.Filter.Eq("Id", documentToModify.Id); var filter = Builders<TDocument>.Filter.Eq("Id", documentToModify.Id);
var updateRes = HandlePartitioned<TDocument, TKey>(documentToModify).UpdateOne(filter, Builders<TDocument>.Update.Set(field, value), cancellationToken: cancellationToken); var updateRes = HandlePartitioned<TDocument, TKey>(documentToModify).UpdateOne(
filter,
Builders<TDocument>.Update.Set(field, value),
cancellationToken: cancellationToken);
return updateRes.ModifiedCount == 1; return updateRes.ModifiedCount == 1;
} }
@@ -7,14 +7,14 @@ using MongoDbGenericRepository.Models;
namespace MongoDbGenericRepository namespace MongoDbGenericRepository
{ {
/// <summary> /// <summary>
/// The IBaseMongoRepository_Create interface to expose document creation functionality /// The IBaseMongoRepository_Create interface to expose document creation functionality
/// with document having an Id of type Guid. /// with document having an Id of type Guid.
/// </summary> /// </summary>
public interface IBaseMongoRepository_Create : IBaseMongoRepository_Create<Guid> public interface IBaseMongoRepository_Create : IBaseMongoRepository_Create<Guid>
{ {
/// <summary> /// <summary>
/// Asynchronously adds a document to the collection. /// Asynchronously adds a document to the collection.
/// Populates the Id and AddedAtUtc fields if necessary. /// Populates the Id and AddedAtUtc fields if necessary.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -24,8 +24,8 @@ namespace MongoDbGenericRepository
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Asynchronously adds a document to the collection. /// Asynchronously adds a document to the collection.
/// Populates the Id and AddedAtUtc fields if necessary. /// Populates the Id and AddedAtUtc fields if necessary.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -36,8 +36,8 @@ namespace MongoDbGenericRepository
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Adds a document to the collection. /// Adds a document to the collection.
/// Populates the Id and AddedAtUtc fields if necessary. /// Populates the Id and AddedAtUtc fields if necessary.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -47,8 +47,8 @@ namespace MongoDbGenericRepository
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Adds a document to the collection. /// Adds a document to the collection.
/// Populates the Id and AddedAtUtc fields if necessary. /// Populates the Id and AddedAtUtc fields if necessary.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -59,8 +59,8 @@ namespace MongoDbGenericRepository
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Asynchronously adds a list of documents to the collection. /// Asynchronously adds a list of documents to the collection.
/// Populates the Id and AddedAtUtc fields if necessary. /// Populates the Id and AddedAtUtc fields if necessary.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -70,8 +70,8 @@ namespace MongoDbGenericRepository
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Asynchronously adds a list of documents to the collection. /// Asynchronously adds a list of documents to the collection.
/// Populates the Id and AddedAtUtc fields if necessary. /// Populates the Id and AddedAtUtc fields if necessary.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -82,8 +82,8 @@ namespace MongoDbGenericRepository
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Adds a list of documents to the collection. /// Adds a list of documents to the collection.
/// Populates the Id and AddedAtUtc fields if necessary. /// Populates the Id and AddedAtUtc fields if necessary.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -93,8 +93,8 @@ namespace MongoDbGenericRepository
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Adds a list of documents to the collection. /// Adds a list of documents to the collection.
/// Populates the Id and AddedAtUtc fields if necessary. /// Populates the Id and AddedAtUtc fields if necessary.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -296,6 +296,5 @@ namespace MongoDbGenericRepository
long DeleteMany<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, string partitionKey, CancellationToken cancellationToken) long DeleteMany<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, string partitionKey, CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
} }
} }
@@ -8,12 +8,12 @@ using MongoDbGenericRepository.Models;
namespace MongoDbGenericRepository namespace MongoDbGenericRepository
{ {
/// <summary> /// <summary>
/// The interface exposing index management functionality for Guid Keyed repositories. /// The interface exposing index management functionality for Guid Keyed repositories.
/// </summary> /// </summary>
public interface IBaseMongoRepository_Index : IBaseMongoRepository_Index<Guid> public interface IBaseMongoRepository_Index : IBaseMongoRepository_Index<Guid>
{ {
/// <summary> /// <summary>
/// Returns the names of the indexes present on a collection. /// Returns the names of the indexes present on a collection.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -23,7 +23,7 @@ namespace MongoDbGenericRepository
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Returns the names of the indexes present on a collection. /// Returns the names of the indexes present on a collection.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -34,7 +34,7 @@ namespace MongoDbGenericRepository
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Returns the names of the indexes present on a collection. /// Returns the names of the indexes present on a collection.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -45,7 +45,7 @@ namespace MongoDbGenericRepository
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Returns the names of the indexes present on a collection. /// Returns the names of the indexes present on a collection.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -57,9 +57,9 @@ namespace MongoDbGenericRepository
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Create a text index on the given field. /// Create a text index on the given field.
/// IndexCreationOptions can be supplied to further specify /// IndexCreationOptions can be supplied to further specify
/// how the creation should be done. /// how the creation should be done.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -70,9 +70,9 @@ namespace MongoDbGenericRepository
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Create a text index on the given field. /// Create a text index on the given field.
/// IndexCreationOptions can be supplied to further specify /// IndexCreationOptions can be supplied to further specify
/// how the creation should be done. /// how the creation should be done.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -84,9 +84,9 @@ namespace MongoDbGenericRepository
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Create a text index on the given field. /// Create a text index on the given field.
/// IndexCreationOptions can be supplied to further specify /// IndexCreationOptions can be supplied to further specify
/// how the creation should be done. /// how the creation should be done.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -98,9 +98,9 @@ namespace MongoDbGenericRepository
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Create a text index on the given field. /// Create a text index on the given field.
/// IndexCreationOptions can be supplied to further specify /// IndexCreationOptions can be supplied to further specify
/// how the creation should be done. /// how the creation should be done.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -113,9 +113,9 @@ namespace MongoDbGenericRepository
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Create a text index on the given field. /// Create a text index on the given field.
/// IndexCreationOptions can be supplied to further specify /// IndexCreationOptions can be supplied to further specify
/// how the creation should be done. /// how the creation should be done.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -127,9 +127,9 @@ namespace MongoDbGenericRepository
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Create a text index on the given field. /// Create a text index on the given field.
/// IndexCreationOptions can be supplied to further specify /// IndexCreationOptions can be supplied to further specify
/// how the creation should be done. /// how the creation should be done.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -137,14 +137,17 @@ namespace MongoDbGenericRepository
/// <param name="indexCreationOptions">Options for creating an index.</param> /// <param name="indexCreationOptions">Options for creating an index.</param>
/// <param name="cancellationToken">The cancellation token</param> /// <param name="cancellationToken">The cancellation token</param>
/// <returns>The result of the create index operation.</returns> /// <returns>The result of the create index operation.</returns>
Task<string> CreateTextIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, CancellationToken cancellationToken) Task<string> CreateTextIndexAsync<TDocument, TKey>(
Expression<Func<TDocument, object>> field,
IndexCreationOptions indexCreationOptions,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Create a text index on the given field. /// Create a text index on the given field.
/// IndexCreationOptions can be supplied to further specify /// IndexCreationOptions can be supplied to further specify
/// how the creation should be done. /// how the creation should be done.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -152,14 +155,17 @@ namespace MongoDbGenericRepository
/// <param name="indexCreationOptions">Options for creating an index.</param> /// <param name="indexCreationOptions">Options for creating an index.</param>
/// <param name="partitionKey">An optional partition key.</param> /// <param name="partitionKey">An optional partition key.</param>
/// <returns>The result of the create index operation.</returns> /// <returns>The result of the create index operation.</returns>
Task<string> CreateTextIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, string partitionKey) Task<string> CreateTextIndexAsync<TDocument, TKey>(
Expression<Func<TDocument, object>> field,
IndexCreationOptions indexCreationOptions,
string partitionKey)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Create a text index on the given field. /// Create a text index on the given field.
/// IndexCreationOptions can be supplied to further specify /// IndexCreationOptions can be supplied to further specify
/// how the creation should be done. /// how the creation should be done.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -168,14 +174,18 @@ namespace MongoDbGenericRepository
/// <param name="partitionKey">An optional partition key.</param> /// <param name="partitionKey">An optional partition key.</param>
/// <param name="cancellationToken">The cancellation token.</param> /// <param name="cancellationToken">The cancellation token.</param>
/// <returns>The result of the create index operation.</returns> /// <returns>The result of the create index operation.</returns>
Task<string> CreateTextIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, string partitionKey, CancellationToken cancellationToken) Task<string> CreateTextIndexAsync<TDocument, TKey>(
Expression<Func<TDocument, object>> field,
IndexCreationOptions indexCreationOptions,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Creates an index on the given field in ascending order. /// Creates an index on the given field in ascending order.
/// IndexCreationOptions can be supplied to further specify /// IndexCreationOptions can be supplied to further specify
/// how the creation should be done. /// how the creation should be done.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -186,9 +196,9 @@ namespace MongoDbGenericRepository
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Creates an index on the given field in ascending order. /// Creates an index on the given field in ascending order.
/// IndexCreationOptions can be supplied to further specify /// IndexCreationOptions can be supplied to further specify
/// how the creation should be done. /// how the creation should be done.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -200,9 +210,9 @@ namespace MongoDbGenericRepository
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Creates an index on the given field in ascending order. /// Creates an index on the given field in ascending order.
/// IndexCreationOptions can be supplied to further specify /// IndexCreationOptions can be supplied to further specify
/// how the creation should be done. /// how the creation should be done.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -214,9 +224,9 @@ namespace MongoDbGenericRepository
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Creates an index on the given field in ascending order. /// Creates an index on the given field in ascending order.
/// IndexCreationOptions can be supplied to further specify /// IndexCreationOptions can be supplied to further specify
/// how the creation should be done. /// how the creation should be done.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -224,14 +234,17 @@ namespace MongoDbGenericRepository
/// <param name="indexCreationOptions">Options for creating an index.</param> /// <param name="indexCreationOptions">Options for creating an index.</param>
/// <param name="cancellationToken">The cancellation token.</param> /// <param name="cancellationToken">The cancellation token.</param>
/// <returns>The result of the create index operation.</returns> /// <returns>The result of the create index operation.</returns>
Task<string> CreateAscendingIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, CancellationToken cancellationToken) Task<string> CreateAscendingIndexAsync<TDocument, TKey>(
Expression<Func<TDocument, object>> field,
IndexCreationOptions indexCreationOptions,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Creates an index on the given field in ascending order. /// Creates an index on the given field in ascending order.
/// IndexCreationOptions can be supplied to further specify /// IndexCreationOptions can be supplied to further specify
/// how the creation should be done. /// how the creation should be done.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -243,9 +256,9 @@ namespace MongoDbGenericRepository
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Creates an index on the given field in ascending order. /// Creates an index on the given field in ascending order.
/// IndexCreationOptions can be supplied to further specify /// IndexCreationOptions can be supplied to further specify
/// how the creation should be done. /// how the creation should be done.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -253,14 +266,17 @@ namespace MongoDbGenericRepository
/// <param name="partitionKey">An optional partition key.</param> /// <param name="partitionKey">An optional partition key.</param>
/// <param name="cancellationToken">The cancellation token.</param> /// <param name="cancellationToken">The cancellation token.</param>
/// <returns>The result of the create index operation.</returns> /// <returns>The result of the create index operation.</returns>
Task<string> CreateAscendingIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, string partitionKey, CancellationToken cancellationToken) Task<string> CreateAscendingIndexAsync<TDocument, TKey>(
Expression<Func<TDocument, object>> field,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Creates an index on the given field in ascending order. /// Creates an index on the given field in ascending order.
/// IndexCreationOptions can be supplied to further specify /// IndexCreationOptions can be supplied to further specify
/// how the creation should be done. /// how the creation should be done.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -268,14 +284,17 @@ namespace MongoDbGenericRepository
/// <param name="indexCreationOptions">Options for creating an index.</param> /// <param name="indexCreationOptions">Options for creating an index.</param>
/// <param name="partitionKey">An optional partition key.</param> /// <param name="partitionKey">An optional partition key.</param>
/// <returns>The result of the create index operation.</returns> /// <returns>The result of the create index operation.</returns>
Task<string> CreateAscendingIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, string partitionKey) Task<string> CreateAscendingIndexAsync<TDocument, TKey>(
Expression<Func<TDocument, object>> field,
IndexCreationOptions indexCreationOptions,
string partitionKey)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Creates an index on the given field in ascending order. /// Creates an index on the given field in ascending order.
/// IndexCreationOptions can be supplied to further specify /// IndexCreationOptions can be supplied to further specify
/// how the creation should be done. /// how the creation should be done.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -284,14 +303,18 @@ namespace MongoDbGenericRepository
/// <param name="partitionKey">An optional partition key.</param> /// <param name="partitionKey">An optional partition key.</param>
/// <param name="cancellationToken">The cancellation token.</param> /// <param name="cancellationToken">The cancellation token.</param>
/// <returns>The result of the create index operation.</returns> /// <returns>The result of the create index operation.</returns>
Task<string> CreateAscendingIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, string partitionKey, CancellationToken cancellationToken) Task<string> CreateAscendingIndexAsync<TDocument, TKey>(
Expression<Func<TDocument, object>> field,
IndexCreationOptions indexCreationOptions,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Creates an index on the given field in descending order. /// Creates an index on the given field in descending order.
/// IndexCreationOptions can be supplied to further specify /// IndexCreationOptions can be supplied to further specify
/// how the creation should be done. /// how the creation should be done.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -302,9 +325,9 @@ namespace MongoDbGenericRepository
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Creates an index on the given field in descending order. /// Creates an index on the given field in descending order.
/// IndexCreationOptions can be supplied to further specify /// IndexCreationOptions can be supplied to further specify
/// how the creation should be done. /// how the creation should be done.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -316,9 +339,9 @@ namespace MongoDbGenericRepository
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Creates an index on the given field in descending order. /// Creates an index on the given field in descending order.
/// IndexCreationOptions can be supplied to further specify /// IndexCreationOptions can be supplied to further specify
/// how the creation should be done. /// how the creation should be done.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -330,9 +353,9 @@ namespace MongoDbGenericRepository
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Creates an index on the given field in descending order. /// Creates an index on the given field in descending order.
/// IndexCreationOptions can be supplied to further specify /// IndexCreationOptions can be supplied to further specify
/// how the creation should be done. /// how the creation should be done.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -340,14 +363,17 @@ namespace MongoDbGenericRepository
/// <param name="indexCreationOptions">Options for creating an index.</param> /// <param name="indexCreationOptions">Options for creating an index.</param>
/// <param name="cancellationToken">The cancellation token.</param> /// <param name="cancellationToken">The cancellation token.</param>
/// <returns>The result of the create index operation.</returns> /// <returns>The result of the create index operation.</returns>
Task<string> CreateDescendingIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, CancellationToken cancellationToken) Task<string> CreateDescendingIndexAsync<TDocument, TKey>(
Expression<Func<TDocument, object>> field,
IndexCreationOptions indexCreationOptions,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Creates an index on the given field in descending order. /// Creates an index on the given field in descending order.
/// IndexCreationOptions can be supplied to further specify /// IndexCreationOptions can be supplied to further specify
/// how the creation should be done. /// how the creation should be done.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -359,9 +385,9 @@ namespace MongoDbGenericRepository
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Creates an index on the given field in descending order. /// Creates an index on the given field in descending order.
/// IndexCreationOptions can be supplied to further specify /// IndexCreationOptions can be supplied to further specify
/// how the creation should be done. /// how the creation should be done.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -369,14 +395,17 @@ namespace MongoDbGenericRepository
/// <param name="partitionKey">An optional partition key.</param> /// <param name="partitionKey">An optional partition key.</param>
/// <param name="cancellationToken">The cancellation token.</param> /// <param name="cancellationToken">The cancellation token.</param>
/// <returns>The result of the create index operation.</returns> /// <returns>The result of the create index operation.</returns>
Task<string> CreateDescendingIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, string partitionKey, CancellationToken cancellationToken) Task<string> CreateDescendingIndexAsync<TDocument, TKey>(
Expression<Func<TDocument, object>> field,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Creates an index on the given field in descending order. /// Creates an index on the given field in descending order.
/// IndexCreationOptions can be supplied to further specify /// IndexCreationOptions can be supplied to further specify
/// how the creation should be done. /// how the creation should be done.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -384,14 +413,17 @@ namespace MongoDbGenericRepository
/// <param name="indexCreationOptions">Options for creating an index.</param> /// <param name="indexCreationOptions">Options for creating an index.</param>
/// <param name="partitionKey">An optional partition key.</param> /// <param name="partitionKey">An optional partition key.</param>
/// <returns>The result of the create index operation.</returns> /// <returns>The result of the create index operation.</returns>
Task<string> CreateDescendingIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, string partitionKey) Task<string> CreateDescendingIndexAsync<TDocument, TKey>(
Expression<Func<TDocument, object>> field,
IndexCreationOptions indexCreationOptions,
string partitionKey)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Creates an index on the given field in descending order. /// Creates an index on the given field in descending order.
/// IndexCreationOptions can be supplied to further specify /// IndexCreationOptions can be supplied to further specify
/// how the creation should be done. /// how the creation should be done.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -400,14 +432,18 @@ namespace MongoDbGenericRepository
/// <param name="partitionKey">An optional partition key.</param> /// <param name="partitionKey">An optional partition key.</param>
/// <param name="cancellationToken">The cancellation token.</param> /// <param name="cancellationToken">The cancellation token.</param>
/// <returns>The result of the create index operation.</returns> /// <returns>The result of the create index operation.</returns>
Task<string> CreateDescendingIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, string partitionKey, CancellationToken cancellationToken) Task<string> CreateDescendingIndexAsync<TDocument, TKey>(
Expression<Func<TDocument, object>> field,
IndexCreationOptions indexCreationOptions,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Creates a hashed index on the given field. /// Creates a hashed index on the given field.
/// IndexCreationOptions can be supplied to further specify /// IndexCreationOptions can be supplied to further specify
/// how the creation should be done. /// how the creation should be done.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -418,9 +454,9 @@ namespace MongoDbGenericRepository
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Creates a hashed index on the given field. /// Creates a hashed index on the given field.
/// IndexCreationOptions can be supplied to further specify /// IndexCreationOptions can be supplied to further specify
/// how the creation should be done. /// how the creation should be done.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -432,9 +468,9 @@ namespace MongoDbGenericRepository
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Creates a hashed index on the given field. /// Creates a hashed index on the given field.
/// IndexCreationOptions can be supplied to further specify /// IndexCreationOptions can be supplied to further specify
/// how the creation should be done. /// how the creation should be done.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -446,9 +482,9 @@ namespace MongoDbGenericRepository
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Creates a hashed index on the given field. /// Creates a hashed index on the given field.
/// IndexCreationOptions can be supplied to further specify /// IndexCreationOptions can be supplied to further specify
/// how the creation should be done. /// how the creation should be done.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -456,14 +492,17 @@ namespace MongoDbGenericRepository
/// <param name="indexCreationOptions">Options for creating an index.</param> /// <param name="indexCreationOptions">Options for creating an index.</param>
/// <param name="cancellationToken">The cancellation token.</param> /// <param name="cancellationToken">The cancellation token.</param>
/// <returns>The result of the create index operation.</returns> /// <returns>The result of the create index operation.</returns>
Task<string> CreateHashedIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, CancellationToken cancellationToken) Task<string> CreateHashedIndexAsync<TDocument, TKey>(
Expression<Func<TDocument, object>> field,
IndexCreationOptions indexCreationOptions,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Creates a hashed index on the given field. /// Creates a hashed index on the given field.
/// IndexCreationOptions can be supplied to further specify /// IndexCreationOptions can be supplied to further specify
/// how the creation should be done. /// how the creation should be done.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -475,9 +514,9 @@ namespace MongoDbGenericRepository
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Creates a hashed index on the given field. /// Creates a hashed index on the given field.
/// IndexCreationOptions can be supplied to further specify /// IndexCreationOptions can be supplied to further specify
/// how the creation should be done. /// how the creation should be done.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -485,14 +524,17 @@ namespace MongoDbGenericRepository
/// <param name="partitionKey">An optional partition key.</param> /// <param name="partitionKey">An optional partition key.</param>
/// <param name="cancellationToken">The cancellation token.</param> /// <param name="cancellationToken">The cancellation token.</param>
/// <returns>The result of the create index operation.</returns> /// <returns>The result of the create index operation.</returns>
Task<string> CreateHashedIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, string partitionKey, CancellationToken cancellationToken) Task<string> CreateHashedIndexAsync<TDocument, TKey>(
Expression<Func<TDocument, object>> field,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Creates a hashed index on the given field. /// Creates a hashed index on the given field.
/// IndexCreationOptions can be supplied to further specify /// IndexCreationOptions can be supplied to further specify
/// how the creation should be done. /// how the creation should be done.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -500,14 +542,17 @@ namespace MongoDbGenericRepository
/// <param name="indexCreationOptions">Options for creating an index.</param> /// <param name="indexCreationOptions">Options for creating an index.</param>
/// <param name="partitionKey">An optional partition key.</param> /// <param name="partitionKey">An optional partition key.</param>
/// <returns>The result of the create index operation.</returns> /// <returns>The result of the create index operation.</returns>
Task<string> CreateHashedIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, string partitionKey) Task<string> CreateHashedIndexAsync<TDocument, TKey>(
Expression<Func<TDocument, object>> field,
IndexCreationOptions indexCreationOptions,
string partitionKey)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Creates a hashed index on the given field. /// Creates a hashed index on the given field.
/// IndexCreationOptions can be supplied to further specify /// IndexCreationOptions can be supplied to further specify
/// how the creation should be done. /// how the creation should be done.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -516,14 +561,18 @@ namespace MongoDbGenericRepository
/// <param name="partitionKey">An optional partition key.</param> /// <param name="partitionKey">An optional partition key.</param>
/// <param name="cancellationToken">The cancellation token.</param> /// <param name="cancellationToken">The cancellation token.</param>
/// <returns>The result of the create index operation.</returns> /// <returns>The result of the create index operation.</returns>
Task<string> CreateHashedIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, string partitionKey, CancellationToken cancellationToken) Task<string> CreateHashedIndexAsync<TDocument, TKey>(
Expression<Func<TDocument, object>> field,
IndexCreationOptions indexCreationOptions,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Creates a combined text index. /// Creates a combined text index.
/// IndexCreationOptions can be supplied to further specify /// IndexCreationOptions can be supplied to further specify
/// how the creation should be done. /// how the creation should be done.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -534,9 +583,9 @@ namespace MongoDbGenericRepository
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Creates a combined text index. /// Creates a combined text index.
/// IndexCreationOptions can be supplied to further specify /// IndexCreationOptions can be supplied to further specify
/// how the creation should be done. /// how the creation should be done.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -548,23 +597,25 @@ namespace MongoDbGenericRepository
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Creates a combined text index. /// Creates a combined text index.
/// IndexCreationOptions can be supplied to further specify /// IndexCreationOptions can be supplied to further specify
/// how the creation should be done. /// how the creation should be done.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <param name="fields">The fields we want to index.</param> /// <param name="fields">The fields we want to index.</param>
/// <param name="indexCreationOptions">Options for creating an index.</param> /// <param name="indexCreationOptions">Options for creating an index.</param>
/// <returns>The result of the create index operation.</returns> /// <returns>The result of the create index operation.</returns>
Task<string> CreateCombinedTextIndexAsync<TDocument, TKey>(IEnumerable<Expression<Func<TDocument, object>>> fields, IndexCreationOptions indexCreationOptions) Task<string> CreateCombinedTextIndexAsync<TDocument, TKey>(
IEnumerable<Expression<Func<TDocument, object>>> fields,
IndexCreationOptions indexCreationOptions)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Creates a combined text index. /// Creates a combined text index.
/// IndexCreationOptions can be supplied to further specify /// IndexCreationOptions can be supplied to further specify
/// how the creation should be done. /// how the creation should be done.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -572,14 +623,17 @@ namespace MongoDbGenericRepository
/// <param name="indexCreationOptions">Options for creating an index.</param> /// <param name="indexCreationOptions">Options for creating an index.</param>
/// <param name="cancellationToken">The cancellation token.</param> /// <param name="cancellationToken">The cancellation token.</param>
/// <returns>The result of the create index operation.</returns> /// <returns>The result of the create index operation.</returns>
Task<string> CreateCombinedTextIndexAsync<TDocument, TKey>(IEnumerable<Expression<Func<TDocument, object>>> fields, IndexCreationOptions indexCreationOptions, CancellationToken cancellationToken) Task<string> CreateCombinedTextIndexAsync<TDocument, TKey>(
IEnumerable<Expression<Func<TDocument, object>>> fields,
IndexCreationOptions indexCreationOptions,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Creates a combined text index. /// Creates a combined text index.
/// IndexCreationOptions can be supplied to further specify /// IndexCreationOptions can be supplied to further specify
/// how the creation should be done. /// how the creation should be done.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -591,9 +645,9 @@ namespace MongoDbGenericRepository
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Creates a combined text index. /// Creates a combined text index.
/// IndexCreationOptions can be supplied to further specify /// IndexCreationOptions can be supplied to further specify
/// how the creation should be done. /// how the creation should be done.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -601,14 +655,17 @@ namespace MongoDbGenericRepository
/// <param name="partitionKey">An optional partition key.</param> /// <param name="partitionKey">An optional partition key.</param>
/// <param name="cancellationToken">The cancellation token.</param> /// <param name="cancellationToken">The cancellation token.</param>
/// <returns>The result of the create index operation.</returns> /// <returns>The result of the create index operation.</returns>
Task<string> CreateCombinedTextIndexAsync<TDocument, TKey>(IEnumerable<Expression<Func<TDocument, object>>> fields, string partitionKey, CancellationToken cancellationToken) Task<string> CreateCombinedTextIndexAsync<TDocument, TKey>(
IEnumerable<Expression<Func<TDocument, object>>> fields,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Creates a combined text index. /// Creates a combined text index.
/// IndexCreationOptions can be supplied to further specify /// IndexCreationOptions can be supplied to further specify
/// how the creation should be done. /// how the creation should be done.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -616,14 +673,17 @@ namespace MongoDbGenericRepository
/// <param name="indexCreationOptions">Options for creating an index.</param> /// <param name="indexCreationOptions">Options for creating an index.</param>
/// <param name="partitionKey">An optional partition key.</param> /// <param name="partitionKey">An optional partition key.</param>
/// <returns>The result of the create index operation.</returns> /// <returns>The result of the create index operation.</returns>
Task<string> CreateCombinedTextIndexAsync<TDocument, TKey>(IEnumerable<Expression<Func<TDocument, object>>> fields, IndexCreationOptions indexCreationOptions, string partitionKey) Task<string> CreateCombinedTextIndexAsync<TDocument, TKey>(
IEnumerable<Expression<Func<TDocument, object>>> fields,
IndexCreationOptions indexCreationOptions,
string partitionKey)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Creates a combined text index. /// Creates a combined text index.
/// IndexCreationOptions can be supplied to further specify /// IndexCreationOptions can be supplied to further specify
/// how the creation should be done. /// how the creation should be done.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -632,12 +692,16 @@ namespace MongoDbGenericRepository
/// <param name="partitionKey">An optional partition key.</param> /// <param name="partitionKey">An optional partition key.</param>
/// <param name="cancellationToken">The cancellation token.</param> /// <param name="cancellationToken">The cancellation token.</param>
/// <returns>The result of the create index operation.</returns> /// <returns>The result of the create index operation.</returns>
Task<string> CreateCombinedTextIndexAsync<TDocument, TKey>(IEnumerable<Expression<Func<TDocument, object>>> fields, IndexCreationOptions indexCreationOptions, string partitionKey, CancellationToken cancellationToken) Task<string> CreateCombinedTextIndexAsync<TDocument, TKey>(
IEnumerable<Expression<Func<TDocument, object>>> fields,
IndexCreationOptions indexCreationOptions,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Drops the index given a field name /// Drops the index given a field name
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -647,7 +711,7 @@ namespace MongoDbGenericRepository
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Drops the index given a field name /// Drops the index given a field name
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -658,7 +722,7 @@ namespace MongoDbGenericRepository
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Drops the index given a field name /// Drops the index given a field name
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -669,7 +733,7 @@ namespace MongoDbGenericRepository
where TKey : IEquatable<TKey>; where TKey : IEquatable<TKey>;
/// <summary> /// <summary>
/// Drops the index given a field name /// Drops the index given a field name
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam> /// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
@@ -1,10 +1,10 @@
using MongoDbGenericRepository.DataAccess.Delete; using System;
using MongoDbGenericRepository.Models;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq.Expressions; using System.Linq.Expressions;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using MongoDbGenericRepository.DataAccess.Delete;
using MongoDbGenericRepository.Models;
namespace MongoDbGenericRepository namespace MongoDbGenericRepository
{ {
@@ -14,13 +14,16 @@ namespace MongoDbGenericRepository
private IMongoDbEraser _mongoDbEraser; private IMongoDbEraser _mongoDbEraser;
/// <summary> /// <summary>
/// The MongoDb accessor to delete data. /// The MongoDb accessor to delete data.
/// </summary> /// </summary>
protected virtual IMongoDbEraser MongoDbEraser protected virtual IMongoDbEraser MongoDbEraser
{ {
get get
{ {
if (_mongoDbEraser != null) { return _mongoDbEraser; } if (_mongoDbEraser != null)
{
return _mongoDbEraser;
}
lock (_initLock) lock (_initLock)
{ {
@@ -29,9 +32,10 @@ namespace MongoDbGenericRepository
_mongoDbEraser = new MongoDbEraser(MongoDbContext); _mongoDbEraser = new MongoDbEraser(MongoDbContext);
} }
} }
return _mongoDbEraser; return _mongoDbEraser;
} }
set { _mongoDbEraser = value; } set => _mongoDbEraser = value;
} }
/// <inheritdoc /> /// <inheritdoc />
@@ -112,7 +116,10 @@ namespace MongoDbGenericRepository
} }
/// <inheritdoc /> /// <inheritdoc />
public virtual async Task<long> DeleteOneAsync<TDocument>(Expression<Func<TDocument, bool>> filter, string partitionKey, CancellationToken cancellationToken) public virtual async Task<long> DeleteOneAsync<TDocument>(
Expression<Func<TDocument, bool>> filter,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
{ {
return await MongoDbEraser.DeleteOneAsync<TDocument, TKey>(filter, partitionKey, cancellationToken); return await MongoDbEraser.DeleteOneAsync<TDocument, TKey>(filter, partitionKey, cancellationToken);
@@ -154,7 +161,10 @@ namespace MongoDbGenericRepository
} }
/// <inheritdoc /> /// <inheritdoc />
public virtual async Task<long> DeleteManyAsync<TDocument>(Expression<Func<TDocument, bool>> filter, string partitionKey, CancellationToken cancellationToken) public virtual async Task<long> DeleteManyAsync<TDocument>(
Expression<Func<TDocument, bool>> filter,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
{ {
return await MongoDbEraser.DeleteManyAsync<TDocument, TKey>(filter, partitionKey, cancellationToken); return await MongoDbEraser.DeleteManyAsync<TDocument, TKey>(filter, partitionKey, cancellationToken);
@@ -178,21 +188,21 @@ namespace MongoDbGenericRepository
public virtual long DeleteMany<TDocument>(Expression<Func<TDocument, bool>> filter) public virtual long DeleteMany<TDocument>(Expression<Func<TDocument, bool>> filter)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
{ {
return DeleteMany<TDocument>(filter, null, CancellationToken.None); return DeleteMany(filter, null, CancellationToken.None);
} }
/// <inheritdoc /> /// <inheritdoc />
public virtual long DeleteMany<TDocument>(Expression<Func<TDocument, bool>> filter, CancellationToken cancellationToken) public virtual long DeleteMany<TDocument>(Expression<Func<TDocument, bool>> filter, CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
{ {
return DeleteMany<TDocument>(filter, null, cancellationToken); return DeleteMany(filter, null, cancellationToken);
} }
/// <inheritdoc /> /// <inheritdoc />
public virtual long DeleteMany<TDocument>(Expression<Func<TDocument, bool>> filter, string partitionKey) public virtual long DeleteMany<TDocument>(Expression<Func<TDocument, bool>> filter, string partitionKey)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
{ {
return DeleteMany<TDocument>(filter, partitionKey, CancellationToken.None); return DeleteMany(filter, partitionKey, CancellationToken.None);
} }
/// <inheritdoc /> /// <inheritdoc />
@@ -202,4 +212,4 @@ namespace MongoDbGenericRepository
return MongoDbEraser.DeleteMany<TDocument, TKey>(filter, partitionKey, cancellationToken); return MongoDbEraser.DeleteMany<TDocument, TKey>(filter, partitionKey, cancellationToken);
} }
} }
} }
@@ -298,14 +298,19 @@ namespace MongoDbGenericRepository
} }
/// <inheritdoc /> /// <inheritdoc />
public virtual async Task<string> CreateHashedIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions) public virtual async Task<string> CreateHashedIndexAsync<TDocument>(
Expression<Func<TDocument, object>> field,
IndexCreationOptions indexCreationOptions)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
{ {
return await CreateHashedIndexAsync(field, indexCreationOptions, null, CancellationToken.None); return await CreateHashedIndexAsync(field, indexCreationOptions, null, CancellationToken.None);
} }
/// <inheritdoc /> /// <inheritdoc />
public virtual async Task<string> CreateHashedIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, CancellationToken cancellationToken) public virtual async Task<string> CreateHashedIndexAsync<TDocument>(
Expression<Func<TDocument, object>> field,
IndexCreationOptions indexCreationOptions,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
{ {
return await CreateHashedIndexAsync(field, indexCreationOptions, null, cancellationToken); return await CreateHashedIndexAsync(field, indexCreationOptions, null, cancellationToken);
@@ -319,21 +324,31 @@ namespace MongoDbGenericRepository
} }
/// <inheritdoc /> /// <inheritdoc />
public virtual async Task<string> CreateHashedIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, string partitionKey, CancellationToken cancellationToken) public virtual async Task<string> CreateHashedIndexAsync<TDocument>(
Expression<Func<TDocument, object>> field,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
{ {
return await CreateHashedIndexAsync(field, null, partitionKey, cancellationToken); return await CreateHashedIndexAsync(field, null, partitionKey, cancellationToken);
} }
/// <inheritdoc /> /// <inheritdoc />
public virtual async Task<string> CreateHashedIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, string partitionKey) public virtual async Task<string> CreateHashedIndexAsync<TDocument>(
Expression<Func<TDocument, object>> field,
IndexCreationOptions indexCreationOptions,
string partitionKey)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
{ {
return await CreateHashedIndexAsync(field, indexCreationOptions, partitionKey, CancellationToken.None); return await CreateHashedIndexAsync(field, indexCreationOptions, partitionKey, CancellationToken.None);
} }
/// <inheritdoc /> /// <inheritdoc />
public virtual async Task<string> CreateHashedIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, string partitionKey, CancellationToken cancellationToken) public virtual async Task<string> CreateHashedIndexAsync<TDocument>(
Expression<Func<TDocument, object>> field,
IndexCreationOptions indexCreationOptions,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
{ {
return await MongoDbIndexHandler.CreateHashedIndexAsync<TDocument, TKey>(field, indexCreationOptions, partitionKey, cancellationToken); return await MongoDbIndexHandler.CreateHashedIndexAsync<TDocument, TKey>(field, indexCreationOptions, partitionKey, cancellationToken);
@@ -347,21 +362,28 @@ namespace MongoDbGenericRepository
} }
/// <inheritdoc /> /// <inheritdoc />
public virtual async Task<string> CreateCombinedTextIndexAsync<TDocument>(IEnumerable<Expression<Func<TDocument, object>>> fields, CancellationToken cancellationToken) public virtual async Task<string> CreateCombinedTextIndexAsync<TDocument>(
IEnumerable<Expression<Func<TDocument, object>>> fields,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
{ {
return await CreateCombinedTextIndexAsync(fields, null, null, cancellationToken); return await CreateCombinedTextIndexAsync(fields, null, null, cancellationToken);
} }
/// <inheritdoc /> /// <inheritdoc />
public virtual async Task<string> CreateCombinedTextIndexAsync<TDocument>(IEnumerable<Expression<Func<TDocument, object>>> fields, IndexCreationOptions indexCreationOptions) public virtual async Task<string> CreateCombinedTextIndexAsync<TDocument>(
IEnumerable<Expression<Func<TDocument, object>>> fields,
IndexCreationOptions indexCreationOptions)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
{ {
return await CreateCombinedTextIndexAsync(fields, indexCreationOptions, null, CancellationToken.None); return await CreateCombinedTextIndexAsync(fields, indexCreationOptions, null, CancellationToken.None);
} }
/// <inheritdoc /> /// <inheritdoc />
public virtual async Task<string> CreateCombinedTextIndexAsync<TDocument>(IEnumerable<Expression<Func<TDocument, object>>> fields, IndexCreationOptions indexCreationOptions, CancellationToken cancellationToken) public virtual async Task<string> CreateCombinedTextIndexAsync<TDocument>(
IEnumerable<Expression<Func<TDocument, object>>> fields,
IndexCreationOptions indexCreationOptions,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
{ {
return await CreateCombinedTextIndexAsync(fields, indexCreationOptions, null, cancellationToken); return await CreateCombinedTextIndexAsync(fields, indexCreationOptions, null, cancellationToken);
@@ -375,21 +397,31 @@ namespace MongoDbGenericRepository
} }
/// <inheritdoc /> /// <inheritdoc />
public virtual async Task<string> CreateCombinedTextIndexAsync<TDocument>(IEnumerable<Expression<Func<TDocument, object>>> fields, string partitionKey, CancellationToken cancellationToken) public virtual async Task<string> CreateCombinedTextIndexAsync<TDocument>(
IEnumerable<Expression<Func<TDocument, object>>> fields,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
{ {
return await CreateCombinedTextIndexAsync(fields, null, partitionKey, cancellationToken); return await CreateCombinedTextIndexAsync(fields, null, partitionKey, cancellationToken);
} }
/// <inheritdoc /> /// <inheritdoc />
public virtual async Task<string> CreateCombinedTextIndexAsync<TDocument>(IEnumerable<Expression<Func<TDocument, object>>> fields, IndexCreationOptions indexCreationOptions, string partitionKey) public virtual async Task<string> CreateCombinedTextIndexAsync<TDocument>(
IEnumerable<Expression<Func<TDocument, object>>> fields,
IndexCreationOptions indexCreationOptions,
string partitionKey)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
{ {
return await CreateCombinedTextIndexAsync(fields, indexCreationOptions, partitionKey, CancellationToken.None); return await CreateCombinedTextIndexAsync(fields, indexCreationOptions, partitionKey, CancellationToken.None);
} }
/// <inheritdoc /> /// <inheritdoc />
public virtual async Task<string> CreateCombinedTextIndexAsync<TDocument>(IEnumerable<Expression<Func<TDocument, object>>> fields, IndexCreationOptions indexCreationOptions, string partitionKey, CancellationToken cancellationToken) public virtual async Task<string> CreateCombinedTextIndexAsync<TDocument>(
IEnumerable<Expression<Func<TDocument, object>>> fields,
IndexCreationOptions indexCreationOptions,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
{ {
return await MongoDbIndexHandler.CreateCombinedTextIndexAsync<TDocument, TKey>(fields, indexCreationOptions, partitionKey, cancellationToken); return await MongoDbIndexHandler.CreateCombinedTextIndexAsync<TDocument, TKey>(fields, indexCreationOptions, partitionKey, cancellationToken);
@@ -1,24 +1,23 @@
using MongoDB.Driver; using System;
using MongoDB.Driver;
using MongoDbGenericRepository.Models; using MongoDbGenericRepository.Models;
using System;
namespace MongoDbGenericRepository namespace MongoDbGenericRepository
{ {
/// <summary> /// <summary>
/// The base Repository, it is meant to be inherited from by your custom custom MongoRepository implementation. /// The base Repository, it is meant to be inherited from by your custom custom MongoRepository implementation.
/// Its constructor must be given a connection string and a database name. /// Its constructor must be given a connection string and a database name.
/// </summary> /// </summary>
/// <typeparam name="TKey">The type of the document Id.</typeparam> /// <typeparam name="TKey">The type of the document Id.</typeparam>
public abstract partial class BaseMongoRepository<TKey> : public abstract partial class BaseMongoRepository<TKey> :
ReadOnlyMongoRepository<TKey>, ReadOnlyMongoRepository<TKey>,
IBaseMongoRepository<TKey> IBaseMongoRepository<TKey>
where TKey : IEquatable<TKey> where TKey : IEquatable<TKey>
{ {
private readonly object _initLock = new object(); private readonly object _initLock = new object();
/// <summary> /// <summary>
/// The constructor taking a connection string and a database name. /// The constructor taking a connection string and a database name.
/// </summary> /// </summary>
/// <param name="connectionString">The connection string of the MongoDb server.</param> /// <param name="connectionString">The connection string of the MongoDb server.</param>
/// <param name="databaseName">The name of the database against which you want to perform operations.</param> /// <param name="databaseName">The name of the database against which you want to perform operations.</param>
@@ -27,23 +26,23 @@ namespace MongoDbGenericRepository
} }
/// <summary> /// <summary>
/// The constructor taking a <see cref="IMongoDbContext"/>. /// The constructor taking a <see cref="IMongoDbContext" />.
/// </summary> /// </summary>
/// <param name="mongoDbContext">A mongodb context implementing <see cref="IMongoDbContext"/></param> /// <param name="mongoDbContext">A mongodb context implementing <see cref="IMongoDbContext" /></param>
protected BaseMongoRepository(IMongoDbContext mongoDbContext) : base(mongoDbContext) protected BaseMongoRepository(IMongoDbContext mongoDbContext) : base(mongoDbContext)
{ {
} }
/// <summary> /// <summary>
/// The constructor taking a <see cref="IMongoDatabase"/>. /// The constructor taking a <see cref="IMongoDatabase" />.
/// </summary> /// </summary>
/// <param name="mongoDatabase">A mongodb context implementing <see cref="IMongoDatabase"/></param> /// <param name="mongoDatabase">A mongodb context implementing <see cref="IMongoDatabase" /></param>
protected BaseMongoRepository(IMongoDatabase mongoDatabase) : base(mongoDatabase) protected BaseMongoRepository(IMongoDatabase mongoDatabase) : base(mongoDatabase)
{ {
} }
/// <summary> /// <summary>
/// Gets a collections for a potentially partitioned document type. /// Gets a collections for a potentially partitioned document type.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The document type.</typeparam> /// <typeparam name="TDocument">The document type.</typeparam>
/// <param name="partitionKey">The collection partition key.</param> /// <param name="partitionKey">The collection partition key.</param>
@@ -55,11 +54,12 @@ namespace MongoDbGenericRepository
{ {
return GetCollection<TDocument>(partitionKey); return GetCollection<TDocument>(partitionKey);
} }
return GetCollection<TDocument>(); return GetCollection<TDocument>();
} }
/// <summary> /// <summary>
/// Gets a collections for the type TDocument with a partition key. /// Gets a collections for the type TDocument with a partition key.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The document type.</typeparam> /// <typeparam name="TDocument">The document type.</typeparam>
/// <param name="partitionKey">The collection partition key.</param> /// <param name="partitionKey">The collection partition key.</param>
@@ -70,4 +70,4 @@ namespace MongoDbGenericRepository
return MongoDbContext.GetCollection<TDocument>(partitionKey); return MongoDbContext.GetCollection<TDocument>(partitionKey);
} }
} }
} }
@@ -17,16 +17,6 @@ namespace MongoDbGenericRepository
public abstract class ReadOnlyMongoRepository<TKey> : IReadOnlyMongoRepository<TKey> public abstract class ReadOnlyMongoRepository<TKey> : IReadOnlyMongoRepository<TKey>
where TKey : IEquatable<TKey> where TKey : IEquatable<TKey>
{ {
/// <summary>
/// The MongoDbContext
/// </summary>
protected IMongoDbContext MongoDbContext { get; set; }
/// <summary>
/// A MongoDb Reader for read operations
/// </summary>
protected IMongoDbReader MongoDbReader { get; set; }
/// <summary> /// <summary>
/// The constructor taking a connection string and a database name. /// The constructor taking a connection string and a database name.
/// </summary> /// </summary>
@@ -55,6 +45,16 @@ namespace MongoDbGenericRepository
SetupMongoDbContext(mongoDbContext); SetupMongoDbContext(mongoDbContext);
} }
/// <summary>
/// The MongoDbContext
/// </summary>
protected IMongoDbContext MongoDbContext { get; set; }
/// <summary>
/// A MongoDb Reader for read operations
/// </summary>
protected IMongoDbReader MongoDbReader { get; set; }
/// <summary> /// <summary>
/// The connection string. /// The connection string.
/// </summary> /// </summary>
@@ -1,10 +1,10 @@
using MongoDB.Driver; using System;
using MongoDbGenericRepository.DataAccess.Update;
using MongoDbGenericRepository.Models;
using System;
using System.Linq.Expressions; using System.Linq.Expressions;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using MongoDB.Driver;
using MongoDbGenericRepository.DataAccess.Update;
using MongoDbGenericRepository.Models;
namespace MongoDbGenericRepository namespace MongoDbGenericRepository
{ {
@@ -14,13 +14,16 @@ namespace MongoDbGenericRepository
private IMongoDbUpdater _mongoDbUpdater; private IMongoDbUpdater _mongoDbUpdater;
/// <summary> /// <summary>
/// The MongoDb accessor to update data. /// The MongoDb accessor to update data.
/// </summary> /// </summary>
protected virtual IMongoDbUpdater MongoDbUpdater protected virtual IMongoDbUpdater MongoDbUpdater
{ {
get get
{ {
if (_mongoDbUpdater != null) { return _mongoDbUpdater; } if (_mongoDbUpdater != null)
{
return _mongoDbUpdater;
}
lock (_initLock) lock (_initLock)
{ {
@@ -32,7 +35,7 @@ namespace MongoDbGenericRepository
return _mongoDbUpdater; return _mongoDbUpdater;
} }
set { _mongoDbUpdater = value; } set => _mongoDbUpdater = value;
} }
/// <inheritdoc /> /// <inheritdoc />
@@ -71,7 +74,10 @@ namespace MongoDbGenericRepository
} }
/// <inheritdoc /> /// <inheritdoc />
public virtual async Task<bool> UpdateOneAsync<TDocument>(TDocument documentToModify, UpdateDefinition<TDocument> update, CancellationToken cancellationToken) public virtual async Task<bool> UpdateOneAsync<TDocument>(
TDocument documentToModify,
UpdateDefinition<TDocument> update,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
{ {
return await MongoDbUpdater.UpdateOneAsync<TDocument, TKey>(documentToModify, update, cancellationToken); return await MongoDbUpdater.UpdateOneAsync<TDocument, TKey>(documentToModify, update, cancellationToken);
@@ -99,7 +105,11 @@ namespace MongoDbGenericRepository
} }
/// <inheritdoc /> /// <inheritdoc />
public virtual bool UpdateOne<TDocument, TField>(TDocument documentToModify, Expression<Func<TDocument, TField>> field, TField value, CancellationToken cancellationToken) public virtual bool UpdateOne<TDocument, TField>(
TDocument documentToModify,
Expression<Func<TDocument, TField>> field,
TField value,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
{ {
return MongoDbUpdater.UpdateOne<TDocument, TKey, TField>(documentToModify, field, value, cancellationToken); return MongoDbUpdater.UpdateOne<TDocument, TKey, TField>(documentToModify, field, value, cancellationToken);
@@ -113,7 +123,11 @@ namespace MongoDbGenericRepository
} }
/// <inheritdoc /> /// <inheritdoc />
public virtual async Task<bool> UpdateOneAsync<TDocument, TField>(TDocument documentToModify, Expression<Func<TDocument, TField>> field, TField value, CancellationToken cancellationToken) public virtual async Task<bool> UpdateOneAsync<TDocument, TField>(
TDocument documentToModify,
Expression<Func<TDocument, TField>> field,
TField value,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
{ {
return await MongoDbUpdater.UpdateOneAsync<TDocument, TKey, TField>(documentToModify, field, value, cancellationToken); return await MongoDbUpdater.UpdateOneAsync<TDocument, TKey, TField>(documentToModify, field, value, cancellationToken);
@@ -127,21 +141,34 @@ namespace MongoDbGenericRepository
} }
/// <inheritdoc /> /// <inheritdoc />
public virtual bool UpdateOne<TDocument, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, CancellationToken cancellationToken) public virtual bool UpdateOne<TDocument, TField>(
FilterDefinition<TDocument> filter,
Expression<Func<TDocument, TField>> field,
TField value,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
{ {
return UpdateOne(filter, field, value, null, cancellationToken); return UpdateOne(filter, field, value, null, cancellationToken);
} }
/// <inheritdoc /> /// <inheritdoc />
public virtual bool UpdateOne<TDocument, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey) public virtual bool UpdateOne<TDocument, TField>(
FilterDefinition<TDocument> filter,
Expression<Func<TDocument, TField>> field,
TField value,
string partitionKey)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
{ {
return UpdateOne(filter, field, value, partitionKey, CancellationToken.None); return UpdateOne(filter, field, value, partitionKey, CancellationToken.None);
} }
/// <inheritdoc /> /// <inheritdoc />
public virtual bool UpdateOne<TDocument, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey, CancellationToken cancellationToken) public virtual bool UpdateOne<TDocument, TField>(
FilterDefinition<TDocument> filter,
Expression<Func<TDocument, TField>> field,
TField value,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
{ {
return MongoDbUpdater.UpdateOne<TDocument, TKey, TField>(filter, field, value, partitionKey, cancellationToken); return MongoDbUpdater.UpdateOne<TDocument, TKey, TField>(filter, field, value, partitionKey, cancellationToken);
@@ -155,133 +182,210 @@ namespace MongoDbGenericRepository
} }
/// <inheritdoc /> /// <inheritdoc />
public virtual bool UpdateOne<TDocument, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, CancellationToken cancellationToken) public virtual bool UpdateOne<TDocument, TField>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TField>> field,
TField value,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
{ {
return UpdateOne(filter, field, value, null, cancellationToken); return UpdateOne(filter, field, value, null, cancellationToken);
} }
/// <inheritdoc /> /// <inheritdoc />
public virtual bool UpdateOne<TDocument, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey) public virtual bool UpdateOne<TDocument, TField>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TField>> field,
TField value,
string partitionKey)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
{ {
return UpdateOne(filter, field, value, partitionKey, CancellationToken.None); return UpdateOne(filter, field, value, partitionKey, CancellationToken.None);
} }
/// <inheritdoc /> /// <inheritdoc />
public virtual bool UpdateOne<TDocument, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey, CancellationToken cancellationToken) public virtual bool UpdateOne<TDocument, TField>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TField>> field,
TField value,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
{ {
return MongoDbUpdater.UpdateOne<TDocument, TKey, TField>(filter, field, value, partitionKey, cancellationToken); return MongoDbUpdater.UpdateOne<TDocument, TKey, TField>(filter, field, value, partitionKey, cancellationToken);
} }
/// <inheritdoc /> /// <inheritdoc />
public virtual async Task<bool> UpdateOneAsync<TDocument, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value) public virtual async Task<bool> UpdateOneAsync<TDocument, TField>(
FilterDefinition<TDocument> filter,
Expression<Func<TDocument, TField>> field,
TField value)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
{ {
return await UpdateOneAsync(filter, field, value, null, CancellationToken.None); return await UpdateOneAsync(filter, field, value, null, CancellationToken.None);
} }
/// <inheritdoc /> /// <inheritdoc />
public virtual async Task<bool> UpdateOneAsync<TDocument, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, CancellationToken cancellationToken) public virtual async Task<bool> UpdateOneAsync<TDocument, TField>(
FilterDefinition<TDocument> filter,
Expression<Func<TDocument, TField>> field,
TField value,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
{ {
return await UpdateOneAsync(filter, field, value, null, cancellationToken); return await UpdateOneAsync(filter, field, value, null, cancellationToken);
} }
/// <inheritdoc /> /// <inheritdoc />
public virtual async Task<bool> UpdateOneAsync<TDocument, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey) public virtual async Task<bool> UpdateOneAsync<TDocument, TField>(
FilterDefinition<TDocument> filter,
Expression<Func<TDocument, TField>> field,
TField value,
string partitionKey)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
{ {
return await UpdateOneAsync(filter, field, value, partitionKey, CancellationToken.None); return await UpdateOneAsync(filter, field, value, partitionKey, CancellationToken.None);
} }
/// <inheritdoc /> /// <inheritdoc />
public virtual async Task<bool> UpdateOneAsync<TDocument, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey, CancellationToken cancellationToken) public virtual async Task<bool> UpdateOneAsync<TDocument, TField>(
FilterDefinition<TDocument> filter,
Expression<Func<TDocument, TField>> field,
TField value,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
{ {
return await MongoDbUpdater.UpdateOneAsync<TDocument, TKey, TField>(filter, field, value, partitionKey, cancellationToken); return await MongoDbUpdater.UpdateOneAsync<TDocument, TKey, TField>(filter, field, value, partitionKey, cancellationToken);
} }
/// <inheritdoc /> /// <inheritdoc />
public virtual async Task<bool> UpdateOneAsync<TDocument, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value) public virtual async Task<bool> UpdateOneAsync<TDocument, TField>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TField>> field,
TField value)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
{ {
return await UpdateOneAsync(filter, field, value, null, CancellationToken.None); return await UpdateOneAsync(filter, field, value, null, CancellationToken.None);
} }
/// <inheritdoc /> /// <inheritdoc />
public virtual async Task<bool> UpdateOneAsync<TDocument, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, CancellationToken cancellationToken) public virtual async Task<bool> UpdateOneAsync<TDocument, TField>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TField>> field,
TField value,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
{ {
return await UpdateOneAsync(filter, field, value, null, cancellationToken); return await UpdateOneAsync(filter, field, value, null, cancellationToken);
} }
/// <inheritdoc /> /// <inheritdoc />
public virtual async Task<bool> UpdateOneAsync<TDocument, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey) public virtual async Task<bool> UpdateOneAsync<TDocument, TField>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TField>> field,
TField value,
string partitionKey)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
{ {
return await UpdateOneAsync(filter, field, value, partitionKey, CancellationToken.None); return await UpdateOneAsync(filter, field, value, partitionKey, CancellationToken.None);
} }
/// <inheritdoc /> /// <inheritdoc />
public virtual async Task<bool> UpdateOneAsync<TDocument, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey, CancellationToken cancellationToken) public virtual async Task<bool> UpdateOneAsync<TDocument, TField>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TField>> field,
TField value,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
{ {
return await MongoDbUpdater.UpdateOneAsync<TDocument, TKey, TField>(filter, field, value, partitionKey, cancellationToken); return await MongoDbUpdater.UpdateOneAsync<TDocument, TKey, TField>(filter, field, value, partitionKey, cancellationToken);
} }
/// <inheritdoc /> /// <inheritdoc />
public virtual async Task<long> UpdateManyAsync<TDocument, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value) public virtual async Task<long> UpdateManyAsync<TDocument, TField>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TField>> field,
TField value)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
{ {
return await UpdateManyAsync(filter, field, value, null, CancellationToken.None); return await UpdateManyAsync(filter, field, value, null, CancellationToken.None);
} }
/// <inheritdoc /> /// <inheritdoc />
public virtual async Task<long> UpdateManyAsync<TDocument, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, CancellationToken cancellationToken) public virtual async Task<long> UpdateManyAsync<TDocument, TField>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TField>> field,
TField value,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
{ {
return await UpdateManyAsync(filter, field, value, null, cancellationToken); return await UpdateManyAsync(filter, field, value, null, cancellationToken);
} }
/// <inheritdoc /> /// <inheritdoc />
public virtual async Task<long> UpdateManyAsync<TDocument, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey) public virtual async Task<long> UpdateManyAsync<TDocument, TField>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TField>> field,
TField value,
string partitionKey)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
{ {
return await UpdateManyAsync(filter, field, value, partitionKey, CancellationToken.None); return await UpdateManyAsync(filter, field, value, partitionKey, CancellationToken.None);
} }
/// <inheritdoc /> /// <inheritdoc />
public virtual async Task<long> UpdateManyAsync<TDocument, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey, CancellationToken cancellationToken) public virtual async Task<long> UpdateManyAsync<TDocument, TField>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TField>> field,
TField value,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
{ {
return await MongoDbUpdater.UpdateManyAsync<TDocument, TKey, TField>(filter, field, value, partitionKey, cancellationToken); return await MongoDbUpdater.UpdateManyAsync<TDocument, TKey, TField>(filter, field, value, partitionKey, cancellationToken);
} }
/// <inheritdoc /> /// <inheritdoc />
public virtual async Task<long> UpdateManyAsync<TDocument, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value) public virtual async Task<long> UpdateManyAsync<TDocument, TField>(
FilterDefinition<TDocument> filter,
Expression<Func<TDocument, TField>> field,
TField value)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
{ {
return await UpdateManyAsync(filter, field, value, null, CancellationToken.None); return await UpdateManyAsync(filter, field, value, null, CancellationToken.None);
} }
/// <inheritdoc /> /// <inheritdoc />
public virtual async Task<long> UpdateManyAsync<TDocument, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, CancellationToken cancellationToken) public virtual async Task<long> UpdateManyAsync<TDocument, TField>(
FilterDefinition<TDocument> filter,
Expression<Func<TDocument, TField>> field,
TField value,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
{ {
return await UpdateManyAsync(filter, field, value, null, cancellationToken); return await UpdateManyAsync(filter, field, value, null, cancellationToken);
} }
/// <inheritdoc /> /// <inheritdoc />
public virtual async Task<long> UpdateManyAsync<TDocument, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey) public virtual async Task<long> UpdateManyAsync<TDocument, TField>(
FilterDefinition<TDocument> filter,
Expression<Func<TDocument, TField>> field,
TField value,
string partitionKey)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
{ {
return await UpdateManyAsync(filter, field, value, partitionKey, CancellationToken.None); return await UpdateManyAsync(filter, field, value, partitionKey, CancellationToken.None);
} }
/// <inheritdoc /> /// <inheritdoc />
public virtual async Task<long> UpdateManyAsync<TDocument, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey, CancellationToken cancellationToken) public virtual async Task<long> UpdateManyAsync<TDocument, TField>(
FilterDefinition<TDocument> filter,
Expression<Func<TDocument, TField>> field,
TField value,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
{ {
return await MongoDbUpdater.UpdateManyAsync<TDocument, TKey, TField>(filter, field, value, partitionKey, cancellationToken); return await MongoDbUpdater.UpdateManyAsync<TDocument, TKey, TField>(filter, field, value, partitionKey, cancellationToken);
@@ -295,21 +399,31 @@ namespace MongoDbGenericRepository
} }
/// <inheritdoc /> /// <inheritdoc />
public virtual async Task<long> UpdateManyAsync<TDocument>(FilterDefinition<TDocument> filter, UpdateDefinition<TDocument> updateDefinition, CancellationToken cancellationToken) public virtual async Task<long> UpdateManyAsync<TDocument>(
FilterDefinition<TDocument> filter,
UpdateDefinition<TDocument> updateDefinition,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
{ {
return await UpdateManyAsync(filter, updateDefinition, null, cancellationToken); return await UpdateManyAsync(filter, updateDefinition, null, cancellationToken);
} }
/// <inheritdoc /> /// <inheritdoc />
public virtual async Task<long> UpdateManyAsync<TDocument>(FilterDefinition<TDocument> filter, UpdateDefinition<TDocument> updateDefinition, string partitionKey) public virtual async Task<long> UpdateManyAsync<TDocument>(
FilterDefinition<TDocument> filter,
UpdateDefinition<TDocument> updateDefinition,
string partitionKey)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
{ {
return await UpdateManyAsync(filter, updateDefinition, partitionKey, CancellationToken.None); return await UpdateManyAsync(filter, updateDefinition, partitionKey, CancellationToken.None);
} }
/// <inheritdoc /> /// <inheritdoc />
public virtual async Task<long> UpdateManyAsync<TDocument>(FilterDefinition<TDocument> filter, UpdateDefinition<TDocument> updateDefinition, string partitionKey, CancellationToken cancellationToken) public virtual async Task<long> UpdateManyAsync<TDocument>(
FilterDefinition<TDocument> filter,
UpdateDefinition<TDocument> updateDefinition,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
{ {
return await MongoDbUpdater.UpdateManyAsync<TDocument, TKey>(filter, updateDefinition, partitionKey, cancellationToken); return await MongoDbUpdater.UpdateManyAsync<TDocument, TKey>(filter, updateDefinition, partitionKey, cancellationToken);
@@ -323,21 +437,31 @@ namespace MongoDbGenericRepository
} }
/// <inheritdoc /> /// <inheritdoc />
public virtual async Task<long> UpdateManyAsync<TDocument>(Expression<Func<TDocument, bool>> filter, UpdateDefinition<TDocument> updateDefinition, CancellationToken cancellationToken) public virtual async Task<long> UpdateManyAsync<TDocument>(
Expression<Func<TDocument, bool>> filter,
UpdateDefinition<TDocument> updateDefinition,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
{ {
return await UpdateManyAsync(filter, updateDefinition, null, cancellationToken); return await UpdateManyAsync(filter, updateDefinition, null, cancellationToken);
} }
/// <inheritdoc /> /// <inheritdoc />
public virtual async Task<long> UpdateManyAsync<TDocument>(Expression<Func<TDocument, bool>> filter, UpdateDefinition<TDocument> updateDefinition, string partitionKey) public virtual async Task<long> UpdateManyAsync<TDocument>(
Expression<Func<TDocument, bool>> filter,
UpdateDefinition<TDocument> updateDefinition,
string partitionKey)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
{ {
return await UpdateManyAsync(filter, updateDefinition, partitionKey, CancellationToken.None); return await UpdateManyAsync(filter, updateDefinition, partitionKey, CancellationToken.None);
} }
/// <inheritdoc /> /// <inheritdoc />
public virtual async Task<long> UpdateManyAsync<TDocument>(Expression<Func<TDocument, bool>> filter, UpdateDefinition<TDocument> updateDefinition, string partitionKey, CancellationToken cancellationToken) public virtual async Task<long> UpdateManyAsync<TDocument>(
Expression<Func<TDocument, bool>> filter,
UpdateDefinition<TDocument> updateDefinition,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
{ {
return await MongoDbUpdater.UpdateManyAsync<TDocument, TKey>(filter, updateDefinition, partitionKey, cancellationToken); return await MongoDbUpdater.UpdateManyAsync<TDocument, TKey>(filter, updateDefinition, partitionKey, cancellationToken);
@@ -351,21 +475,34 @@ namespace MongoDbGenericRepository
} }
/// <inheritdoc /> /// <inheritdoc />
public virtual long UpdateMany<TDocument, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, CancellationToken cancellationToken) public virtual long UpdateMany<TDocument, TField>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TField>> field,
TField value,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
{ {
return UpdateMany(filter, field, value, null, cancellationToken); return UpdateMany(filter, field, value, null, cancellationToken);
} }
/// <inheritdoc /> /// <inheritdoc />
public virtual long UpdateMany<TDocument, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey) public virtual long UpdateMany<TDocument, TField>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TField>> field,
TField value,
string partitionKey)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
{ {
return UpdateMany(filter, field, value, partitionKey, CancellationToken.None); return UpdateMany(filter, field, value, partitionKey, CancellationToken.None);
} }
/// <inheritdoc /> /// <inheritdoc />
public virtual long UpdateMany<TDocument, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey, CancellationToken cancellationToken) public virtual long UpdateMany<TDocument, TField>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TField>> field,
TField value,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
{ {
return MongoDbUpdater.UpdateMany<TDocument, TKey, TField>(filter, field, value, partitionKey, cancellationToken); return MongoDbUpdater.UpdateMany<TDocument, TKey, TField>(filter, field, value, partitionKey, cancellationToken);
@@ -379,21 +516,34 @@ namespace MongoDbGenericRepository
} }
/// <inheritdoc /> /// <inheritdoc />
public virtual long UpdateMany<TDocument, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, CancellationToken cancellationToken) public virtual long UpdateMany<TDocument, TField>(
FilterDefinition<TDocument> filter,
Expression<Func<TDocument, TField>> field,
TField value,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
{ {
return MongoDbUpdater.UpdateMany<TDocument, TKey, TField>(filter, field, value, null, cancellationToken); return MongoDbUpdater.UpdateMany<TDocument, TKey, TField>(filter, field, value, null, cancellationToken);
} }
/// <inheritdoc /> /// <inheritdoc />
public virtual long UpdateMany<TDocument, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey) public virtual long UpdateMany<TDocument, TField>(
FilterDefinition<TDocument> filter,
Expression<Func<TDocument, TField>> field,
TField value,
string partitionKey)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
{ {
return MongoDbUpdater.UpdateMany<TDocument, TKey, TField>(filter, field, value, partitionKey, CancellationToken.None); return MongoDbUpdater.UpdateMany<TDocument, TKey, TField>(filter, field, value, partitionKey, CancellationToken.None);
} }
/// <inheritdoc /> /// <inheritdoc />
public virtual long UpdateMany<TDocument, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey, CancellationToken cancellationToken) public virtual long UpdateMany<TDocument, TField>(
FilterDefinition<TDocument> filter,
Expression<Func<TDocument, TField>> field,
TField value,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
{ {
return MongoDbUpdater.UpdateMany<TDocument, TKey, TField>(filter, field, value, partitionKey, cancellationToken); return MongoDbUpdater.UpdateMany<TDocument, TKey, TField>(filter, field, value, partitionKey, cancellationToken);
@@ -407,7 +557,10 @@ namespace MongoDbGenericRepository
} }
/// <inheritdoc /> /// <inheritdoc />
public virtual long UpdateMany<TDocument>(FilterDefinition<TDocument> filter, UpdateDefinition<TDocument> updateDefinition, CancellationToken cancellationToken) public virtual long UpdateMany<TDocument>(
FilterDefinition<TDocument> filter,
UpdateDefinition<TDocument> updateDefinition,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
{ {
return UpdateMany(filter, updateDefinition, null, cancellationToken); return UpdateMany(filter, updateDefinition, null, cancellationToken);
@@ -421,7 +574,11 @@ namespace MongoDbGenericRepository
} }
/// <inheritdoc /> /// <inheritdoc />
public virtual long UpdateMany<TDocument>(FilterDefinition<TDocument> filter, UpdateDefinition<TDocument> updateDefinition, string partitionKey, CancellationToken cancellationToken) public virtual long UpdateMany<TDocument>(
FilterDefinition<TDocument> filter,
UpdateDefinition<TDocument> updateDefinition,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
{ {
return MongoDbUpdater.UpdateMany<TDocument, TKey>(filter, updateDefinition, partitionKey, cancellationToken); return MongoDbUpdater.UpdateMany<TDocument, TKey>(filter, updateDefinition, partitionKey, cancellationToken);
@@ -435,7 +592,10 @@ namespace MongoDbGenericRepository
} }
/// <inheritdoc /> /// <inheritdoc />
public virtual long UpdateMany<TDocument>(Expression<Func<TDocument, bool>> filter, UpdateDefinition<TDocument> updateDefinition, CancellationToken cancellationToken) public virtual long UpdateMany<TDocument>(
Expression<Func<TDocument, bool>> filter,
UpdateDefinition<TDocument> updateDefinition,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
{ {
return UpdateMany(filter, updateDefinition, null, cancellationToken); return UpdateMany(filter, updateDefinition, null, cancellationToken);
@@ -449,7 +609,11 @@ namespace MongoDbGenericRepository
} }
/// <inheritdoc /> /// <inheritdoc />
public virtual long UpdateMany<TDocument>(Expression<Func<TDocument, bool>> filter, UpdateDefinition<TDocument> updateDefinition, string partitionKey, CancellationToken cancellationToken) public virtual long UpdateMany<TDocument>(
Expression<Func<TDocument, bool>> filter,
UpdateDefinition<TDocument> updateDefinition,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey> where TDocument : IDocument<TKey>
{ {
return MongoDbUpdater.UpdateMany<TDocument, TKey>(filter, updateDefinition, partitionKey, cancellationToken); return MongoDbUpdater.UpdateMany<TDocument, TKey>(filter, updateDefinition, partitionKey, cancellationToken);
@@ -8,14 +8,14 @@ using MongoDbGenericRepository.Models;
namespace MongoDbGenericRepository namespace MongoDbGenericRepository
{ {
/// <summary> /// <summary>
/// The interface exposing deletion functionality for Key typed repositories. /// The interface exposing deletion functionality for Key typed repositories.
/// </summary> /// </summary>
/// <typeparam name="TKey">The type of the document Id.</typeparam> /// <typeparam name="TKey">The type of the document Id.</typeparam>
public interface IBaseMongoRepository_Delete<TKey> public interface IBaseMongoRepository_Delete<TKey>
where TKey : IEquatable<TKey> where TKey : IEquatable<TKey>
{ {
/// <summary> /// <summary>
/// Deletes a document. /// Deletes a document.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <param name="document">The document you want to delete.</param> /// <param name="document">The document you want to delete.</param>
@@ -24,7 +24,7 @@ namespace MongoDbGenericRepository
where TDocument : IDocument<TKey>; where TDocument : IDocument<TKey>;
/// <summary> /// <summary>
/// Deletes a document. /// Deletes a document.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <param name="document">The document you want to delete.</param> /// <param name="document">The document you want to delete.</param>
@@ -34,7 +34,7 @@ namespace MongoDbGenericRepository
where TDocument : IDocument<TKey>; where TDocument : IDocument<TKey>;
/// <summary> /// <summary>
/// Deletes a document matching the condition of the LINQ expression filter. /// Deletes a document matching the condition of the LINQ expression filter.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <param name="filter">A LINQ expression filter.</param> /// <param name="filter">A LINQ expression filter.</param>
@@ -43,7 +43,7 @@ namespace MongoDbGenericRepository
where TDocument : IDocument<TKey>; where TDocument : IDocument<TKey>;
/// <summary> /// <summary>
/// Deletes a document matching the condition of the LINQ expression filter. /// Deletes a document matching the condition of the LINQ expression filter.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <param name="filter">A LINQ expression filter.</param> /// <param name="filter">A LINQ expression filter.</param>
@@ -53,7 +53,7 @@ namespace MongoDbGenericRepository
where TDocument : IDocument<TKey>; where TDocument : IDocument<TKey>;
/// <summary> /// <summary>
/// Deletes a document matching the condition of the LINQ expression filter. /// Deletes a document matching the condition of the LINQ expression filter.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <param name="filter">A LINQ expression filter.</param> /// <param name="filter">A LINQ expression filter.</param>
@@ -63,7 +63,7 @@ namespace MongoDbGenericRepository
where TDocument : IDocument<TKey>; where TDocument : IDocument<TKey>;
/// <summary> /// <summary>
/// Deletes a document matching the condition of the LINQ expression filter. /// Deletes a document matching the condition of the LINQ expression filter.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <param name="filter">A LINQ expression filter.</param> /// <param name="filter">A LINQ expression filter.</param>
@@ -74,7 +74,7 @@ namespace MongoDbGenericRepository
where TDocument : IDocument<TKey>; where TDocument : IDocument<TKey>;
/// <summary> /// <summary>
/// Asynchronously deletes a document matching the condition of the LINQ expression filter. /// Asynchronously deletes a document matching the condition of the LINQ expression filter.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <param name="document">The document you want to delete.</param> /// <param name="document">The document you want to delete.</param>
@@ -83,7 +83,7 @@ namespace MongoDbGenericRepository
where TDocument : IDocument<TKey>; where TDocument : IDocument<TKey>;
/// <summary> /// <summary>
/// Asynchronously deletes a document matching the condition of the LINQ expression filter. /// Asynchronously deletes a document matching the condition of the LINQ expression filter.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <param name="document">The document you want to delete.</param> /// <param name="document">The document you want to delete.</param>
@@ -94,7 +94,7 @@ namespace MongoDbGenericRepository
/// <summary> /// <summary>
/// Asynchronously deletes a document matching the condition of the LINQ expression filter. /// Asynchronously deletes a document matching the condition of the LINQ expression filter.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <param name="filter">A LINQ expression filter.</param> /// <param name="filter">A LINQ expression filter.</param>
@@ -103,7 +103,7 @@ namespace MongoDbGenericRepository
where TDocument : IDocument<TKey>; where TDocument : IDocument<TKey>;
/// <summary> /// <summary>
/// Asynchronously deletes a document matching the condition of the LINQ expression filter. /// Asynchronously deletes a document matching the condition of the LINQ expression filter.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <param name="filter">A LINQ expression filter.</param> /// <param name="filter">A LINQ expression filter.</param>
@@ -113,7 +113,7 @@ namespace MongoDbGenericRepository
where TDocument : IDocument<TKey>; where TDocument : IDocument<TKey>;
/// <summary> /// <summary>
/// Asynchronously deletes a document matching the condition of the LINQ expression filter. /// Asynchronously deletes a document matching the condition of the LINQ expression filter.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <param name="filter">A LINQ expression filter.</param> /// <param name="filter">A LINQ expression filter.</param>
@@ -123,7 +123,7 @@ namespace MongoDbGenericRepository
where TDocument : IDocument<TKey>; where TDocument : IDocument<TKey>;
/// <summary> /// <summary>
/// Asynchronously deletes a document matching the condition of the LINQ expression filter. /// Asynchronously deletes a document matching the condition of the LINQ expression filter.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <param name="filter">A LINQ expression filter.</param> /// <param name="filter">A LINQ expression filter.</param>
@@ -134,7 +134,7 @@ namespace MongoDbGenericRepository
where TDocument : IDocument<TKey>; where TDocument : IDocument<TKey>;
/// <summary> /// <summary>
/// Asynchronously deletes the documents matching the condition of the LINQ expression filter. /// Asynchronously deletes the documents matching the condition of the LINQ expression filter.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <param name="filter">A LINQ expression filter.</param> /// <param name="filter">A LINQ expression filter.</param>
@@ -143,7 +143,7 @@ namespace MongoDbGenericRepository
where TDocument : IDocument<TKey>; where TDocument : IDocument<TKey>;
/// <summary> /// <summary>
/// Asynchronously deletes the documents matching the condition of the LINQ expression filter. /// Asynchronously deletes the documents matching the condition of the LINQ expression filter.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <param name="filter">A LINQ expression filter.</param> /// <param name="filter">A LINQ expression filter.</param>
@@ -153,7 +153,7 @@ namespace MongoDbGenericRepository
where TDocument : IDocument<TKey>; where TDocument : IDocument<TKey>;
/// <summary> /// <summary>
/// Asynchronously deletes the documents matching the condition of the LINQ expression filter. /// Asynchronously deletes the documents matching the condition of the LINQ expression filter.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <param name="filter">A LINQ expression filter.</param> /// <param name="filter">A LINQ expression filter.</param>
@@ -163,7 +163,7 @@ namespace MongoDbGenericRepository
where TDocument : IDocument<TKey>; where TDocument : IDocument<TKey>;
/// <summary> /// <summary>
/// Asynchronously deletes the documents matching the condition of the LINQ expression filter. /// Asynchronously deletes the documents matching the condition of the LINQ expression filter.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <param name="filter">A LINQ expression filter.</param> /// <param name="filter">A LINQ expression filter.</param>
@@ -174,7 +174,7 @@ namespace MongoDbGenericRepository
where TDocument : IDocument<TKey>; where TDocument : IDocument<TKey>;
/// <summary> /// <summary>
/// Asynchronously deletes a list of documents. /// Asynchronously deletes a list of documents.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <param name="documents">The list of documents to delete.</param> /// <param name="documents">The list of documents to delete.</param>
@@ -183,7 +183,7 @@ namespace MongoDbGenericRepository
where TDocument : IDocument<TKey>; where TDocument : IDocument<TKey>;
/// <summary> /// <summary>
/// Asynchronously deletes a list of documents. /// Asynchronously deletes a list of documents.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <param name="documents">The list of documents to delete.</param> /// <param name="documents">The list of documents to delete.</param>
@@ -193,7 +193,7 @@ namespace MongoDbGenericRepository
where TDocument : IDocument<TKey>; where TDocument : IDocument<TKey>;
/// <summary> /// <summary>
/// Deletes a list of documents. /// Deletes a list of documents.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <param name="documents">The list of documents to delete.</param> /// <param name="documents">The list of documents to delete.</param>
@@ -202,7 +202,7 @@ namespace MongoDbGenericRepository
where TDocument : IDocument<TKey>; where TDocument : IDocument<TKey>;
/// <summary> /// <summary>
/// Deletes a list of documents. /// Deletes a list of documents.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <param name="documents">The list of documents to delete.</param> /// <param name="documents">The list of documents to delete.</param>
@@ -212,7 +212,7 @@ namespace MongoDbGenericRepository
where TDocument : IDocument<TKey>; where TDocument : IDocument<TKey>;
/// <summary> /// <summary>
/// Deletes the documents matching the condition of the LINQ expression filter. /// Deletes the documents matching the condition of the LINQ expression filter.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <param name="filter">A LINQ expression filter.</param> /// <param name="filter">A LINQ expression filter.</param>
@@ -221,7 +221,7 @@ namespace MongoDbGenericRepository
where TDocument : IDocument<TKey>; where TDocument : IDocument<TKey>;
/// <summary> /// <summary>
/// Deletes the documents matching the condition of the LINQ expression filter. /// Deletes the documents matching the condition of the LINQ expression filter.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <param name="filter">A LINQ expression filter.</param> /// <param name="filter">A LINQ expression filter.</param>
@@ -231,7 +231,7 @@ namespace MongoDbGenericRepository
where TDocument : IDocument<TKey>; where TDocument : IDocument<TKey>;
/// <summary> /// <summary>
/// Deletes the documents matching the condition of the LINQ expression filter. /// Deletes the documents matching the condition of the LINQ expression filter.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <param name="filter">A LINQ expression filter.</param> /// <param name="filter">A LINQ expression filter.</param>
@@ -241,7 +241,7 @@ namespace MongoDbGenericRepository
where TDocument : IDocument<TKey>; where TDocument : IDocument<TKey>;
/// <summary> /// <summary>
/// Deletes the documents matching the condition of the LINQ expression filter. /// Deletes the documents matching the condition of the LINQ expression filter.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <param name="filter">A LINQ expression filter.</param> /// <param name="filter">A LINQ expression filter.</param>
@@ -8,13 +8,14 @@ using MongoDbGenericRepository.Models;
namespace MongoDbGenericRepository namespace MongoDbGenericRepository
{ {
/// <summary> /// <summary>
/// The interface exposing index management functionality for Key typed repositories. /// The interface exposing index management functionality for Key typed repositories.
/// </summary> /// </summary>
/// <typeparam name="TKey"></typeparam> /// <typeparam name="TKey"></typeparam>
public interface IBaseMongoRepository_Index<TKey> where TKey : IEquatable<TKey> public interface IBaseMongoRepository_Index<TKey>
where TKey : IEquatable<TKey>
{ {
/// <summary> /// <summary>
/// Returns the names of the indexes present on a collection. /// Returns the names of the indexes present on a collection.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <returns>A list containing the names of the indexes on on the concerned collection.</returns> /// <returns>A list containing the names of the indexes on on the concerned collection.</returns>
@@ -22,7 +23,7 @@ namespace MongoDbGenericRepository
where TDocument : IDocument<TKey>; where TDocument : IDocument<TKey>;
/// <summary> /// <summary>
/// Returns the names of the indexes present on a collection. /// Returns the names of the indexes present on a collection.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <param name="cancellationToken">The cancellation token.</param> /// <param name="cancellationToken">The cancellation token.</param>
@@ -31,7 +32,7 @@ namespace MongoDbGenericRepository
where TDocument : IDocument<TKey>; where TDocument : IDocument<TKey>;
/// <summary> /// <summary>
/// Returns the names of the indexes present on a collection. /// Returns the names of the indexes present on a collection.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <param name="partitionKey">An optional partition key</param> /// <param name="partitionKey">An optional partition key</param>
@@ -40,7 +41,7 @@ namespace MongoDbGenericRepository
where TDocument : IDocument<TKey>; where TDocument : IDocument<TKey>;
/// <summary> /// <summary>
/// Returns the names of the indexes present on a collection. /// Returns the names of the indexes present on a collection.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <param name="partitionKey">An optional partition key</param> /// <param name="partitionKey">An optional partition key</param>
@@ -50,9 +51,9 @@ namespace MongoDbGenericRepository
where TDocument : IDocument<TKey>; where TDocument : IDocument<TKey>;
/// <summary> /// <summary>
/// Create a text index on the given field. /// Create a text index on the given field.
/// IndexCreationOptions can be supplied to further specify /// IndexCreationOptions can be supplied to further specify
/// how the creation should be done. /// how the creation should be done.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <param name="field">The field we want to index.</param> /// <param name="field">The field we want to index.</param>
@@ -61,9 +62,9 @@ namespace MongoDbGenericRepository
where TDocument : IDocument<TKey>; where TDocument : IDocument<TKey>;
/// <summary> /// <summary>
/// Create a text index on the given field. /// Create a text index on the given field.
/// IndexCreationOptions can be supplied to further specify /// IndexCreationOptions can be supplied to further specify
/// how the creation should be done. /// how the creation should be done.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <param name="field">The field we want to index.</param> /// <param name="field">The field we want to index.</param>
@@ -73,9 +74,9 @@ namespace MongoDbGenericRepository
where TDocument : IDocument<TKey>; where TDocument : IDocument<TKey>;
/// <summary> /// <summary>
/// Create a text index on the given field. /// Create a text index on the given field.
/// IndexCreationOptions can be supplied to further specify /// IndexCreationOptions can be supplied to further specify
/// how the creation should be done. /// how the creation should be done.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <param name="field">The field we want to index.</param> /// <param name="field">The field we want to index.</param>
@@ -85,22 +86,25 @@ namespace MongoDbGenericRepository
where TDocument : IDocument<TKey>; where TDocument : IDocument<TKey>;
/// <summary> /// <summary>
/// Create a text index on the given field. /// Create a text index on the given field.
/// IndexCreationOptions can be supplied to further specify /// IndexCreationOptions can be supplied to further specify
/// how the creation should be done. /// how the creation should be done.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <param name="field">The field we want to index.</param> /// <param name="field">The field we want to index.</param>
/// <param name="indexCreationOptions">Options for creating an index.</param> /// <param name="indexCreationOptions">Options for creating an index.</param>
/// <param name="cancellationToken">The cancellation token.</param> /// <param name="cancellationToken">The cancellation token.</param>
/// <returns>The result of the create index operation.</returns> /// <returns>The result of the create index operation.</returns>
Task<string> CreateTextIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, CancellationToken cancellationToken) Task<string> CreateTextIndexAsync<TDocument>(
Expression<Func<TDocument, object>> field,
IndexCreationOptions indexCreationOptions,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>; where TDocument : IDocument<TKey>;
/// <summary> /// <summary>
/// Create a text index on the given field. /// Create a text index on the given field.
/// IndexCreationOptions can be supplied to further specify /// IndexCreationOptions can be supplied to further specify
/// how the creation should be done. /// how the creation should be done.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <param name="field">The field we want to index.</param> /// <param name="field">The field we want to index.</param>
@@ -110,9 +114,9 @@ namespace MongoDbGenericRepository
where TDocument : IDocument<TKey>; where TDocument : IDocument<TKey>;
/// <summary> /// <summary>
/// Create a text index on the given field. /// Create a text index on the given field.
/// IndexCreationOptions can be supplied to further specify /// IndexCreationOptions can be supplied to further specify
/// how the creation should be done. /// how the creation should be done.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <param name="field">The field we want to index.</param> /// <param name="field">The field we want to index.</param>
@@ -123,9 +127,9 @@ namespace MongoDbGenericRepository
where TDocument : IDocument<TKey>; where TDocument : IDocument<TKey>;
/// <summary> /// <summary>
/// Create a text index on the given field. /// Create a text index on the given field.
/// IndexCreationOptions can be supplied to further specify /// IndexCreationOptions can be supplied to further specify
/// how the creation should be done. /// how the creation should be done.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <param name="field">The field we want to index.</param> /// <param name="field">The field we want to index.</param>
@@ -136,9 +140,9 @@ namespace MongoDbGenericRepository
where TDocument : IDocument<TKey>; where TDocument : IDocument<TKey>;
/// <summary> /// <summary>
/// Create a text index on the given field. /// Create a text index on the given field.
/// IndexCreationOptions can be supplied to further specify /// IndexCreationOptions can be supplied to further specify
/// how the creation should be done. /// how the creation should be done.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <param name="field">The field we want to index.</param> /// <param name="field">The field we want to index.</param>
@@ -146,14 +150,18 @@ namespace MongoDbGenericRepository
/// <param name="partitionKey">An optional partition key.</param> /// <param name="partitionKey">An optional partition key.</param>
/// <param name="cancellationToken">The cancellation token.</param> /// <param name="cancellationToken">The cancellation token.</param>
/// <returns>The result of the create index operation.</returns> /// <returns>The result of the create index operation.</returns>
Task<string> CreateTextIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, string partitionKey, CancellationToken cancellationToken) Task<string> CreateTextIndexAsync<TDocument>(
Expression<Func<TDocument, object>> field,
IndexCreationOptions indexCreationOptions,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>; where TDocument : IDocument<TKey>;
/// <summary> /// <summary>
/// Creates an index on the given field in ascending order. /// Creates an index on the given field in ascending order.
/// IndexCreationOptions can be supplied to further specify /// IndexCreationOptions can be supplied to further specify
/// how the creation should be done. /// how the creation should be done.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <param name="field">The field we want to index.</param> /// <param name="field">The field we want to index.</param>
@@ -162,9 +170,9 @@ namespace MongoDbGenericRepository
where TDocument : IDocument<TKey>; where TDocument : IDocument<TKey>;
/// <summary> /// <summary>
/// Creates an index on the given field in ascending order. /// Creates an index on the given field in ascending order.
/// IndexCreationOptions can be supplied to further specify /// IndexCreationOptions can be supplied to further specify
/// how the creation should be done. /// how the creation should be done.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <param name="field">The field we want to index.</param> /// <param name="field">The field we want to index.</param>
@@ -174,9 +182,9 @@ namespace MongoDbGenericRepository
where TDocument : IDocument<TKey>; where TDocument : IDocument<TKey>;
/// <summary> /// <summary>
/// Creates an index on the given field in ascending order. /// Creates an index on the given field in ascending order.
/// IndexCreationOptions can be supplied to further specify /// IndexCreationOptions can be supplied to further specify
/// how the creation should be done. /// how the creation should be done.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <param name="field">The field we want to index.</param> /// <param name="field">The field we want to index.</param>
@@ -186,22 +194,25 @@ namespace MongoDbGenericRepository
where TDocument : IDocument<TKey>; where TDocument : IDocument<TKey>;
/// <summary> /// <summary>
/// Creates an index on the given field in ascending order. /// Creates an index on the given field in ascending order.
/// IndexCreationOptions can be supplied to further specify /// IndexCreationOptions can be supplied to further specify
/// how the creation should be done. /// how the creation should be done.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <param name="field">The field we want to index.</param> /// <param name="field">The field we want to index.</param>
/// <param name="indexCreationOptions">Options for creating an index.</param> /// <param name="indexCreationOptions">Options for creating an index.</param>
/// <param name="cancellationToken">The cancellation token.</param> /// <param name="cancellationToken">The cancellation token.</param>
/// <returns>The result of the create index operation.</returns> /// <returns>The result of the create index operation.</returns>
Task<string> CreateAscendingIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, CancellationToken cancellationToken) Task<string> CreateAscendingIndexAsync<TDocument>(
Expression<Func<TDocument, object>> field,
IndexCreationOptions indexCreationOptions,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>; where TDocument : IDocument<TKey>;
/// <summary> /// <summary>
/// Creates an index on the given field in ascending order. /// Creates an index on the given field in ascending order.
/// IndexCreationOptions can be supplied to further specify /// IndexCreationOptions can be supplied to further specify
/// how the creation should be done. /// how the creation should be done.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <param name="field">The field we want to index.</param> /// <param name="field">The field we want to index.</param>
@@ -211,9 +222,9 @@ namespace MongoDbGenericRepository
where TDocument : IDocument<TKey>; where TDocument : IDocument<TKey>;
/// <summary> /// <summary>
/// Creates an index on the given field in ascending order. /// Creates an index on the given field in ascending order.
/// IndexCreationOptions can be supplied to further specify /// IndexCreationOptions can be supplied to further specify
/// how the creation should be done. /// how the creation should be done.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <param name="field">The field we want to index.</param> /// <param name="field">The field we want to index.</param>
@@ -224,22 +235,25 @@ namespace MongoDbGenericRepository
where TDocument : IDocument<TKey>; where TDocument : IDocument<TKey>;
/// <summary> /// <summary>
/// Creates an index on the given field in ascending order. /// Creates an index on the given field in ascending order.
/// IndexCreationOptions can be supplied to further specify /// IndexCreationOptions can be supplied to further specify
/// how the creation should be done. /// how the creation should be done.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <param name="field">The field we want to index.</param> /// <param name="field">The field we want to index.</param>
/// <param name="indexCreationOptions">Options for creating an index.</param> /// <param name="indexCreationOptions">Options for creating an index.</param>
/// <param name="partitionKey">An optional partition key.</param> /// <param name="partitionKey">An optional partition key.</param>
/// <returns>The result of the create index operation.</returns> /// <returns>The result of the create index operation.</returns>
Task<string> CreateAscendingIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, string partitionKey) Task<string> CreateAscendingIndexAsync<TDocument>(
Expression<Func<TDocument, object>> field,
IndexCreationOptions indexCreationOptions,
string partitionKey)
where TDocument : IDocument<TKey>; where TDocument : IDocument<TKey>;
/// <summary> /// <summary>
/// Creates an index on the given field in ascending order. /// Creates an index on the given field in ascending order.
/// IndexCreationOptions can be supplied to further specify /// IndexCreationOptions can be supplied to further specify
/// how the creation should be done. /// how the creation should be done.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <param name="field">The field we want to index.</param> /// <param name="field">The field we want to index.</param>
@@ -247,13 +261,17 @@ namespace MongoDbGenericRepository
/// <param name="partitionKey">An optional partition key.</param> /// <param name="partitionKey">An optional partition key.</param>
/// <param name="cancellationToken">The cancellation token.</param> /// <param name="cancellationToken">The cancellation token.</param>
/// <returns>The result of the create index operation.</returns> /// <returns>The result of the create index operation.</returns>
Task<string> CreateAscendingIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, string partitionKey, CancellationToken cancellationToken) Task<string> CreateAscendingIndexAsync<TDocument>(
Expression<Func<TDocument, object>> field,
IndexCreationOptions indexCreationOptions,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>; where TDocument : IDocument<TKey>;
/// <summary> /// <summary>
/// Creates an index on the given field in descending order. /// Creates an index on the given field in descending order.
/// IndexCreationOptions can be supplied to further specify /// IndexCreationOptions can be supplied to further specify
/// how the creation should be done. /// how the creation should be done.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <param name="field">The field we want to index.</param> /// <param name="field">The field we want to index.</param>
@@ -262,9 +280,9 @@ namespace MongoDbGenericRepository
where TDocument : IDocument<TKey>; where TDocument : IDocument<TKey>;
/// <summary> /// <summary>
/// Creates an index on the given field in descending order. /// Creates an index on the given field in descending order.
/// IndexCreationOptions can be supplied to further specify /// IndexCreationOptions can be supplied to further specify
/// how the creation should be done. /// how the creation should be done.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <param name="field">The field we want to index.</param> /// <param name="field">The field we want to index.</param>
@@ -274,9 +292,9 @@ namespace MongoDbGenericRepository
where TDocument : IDocument<TKey>; where TDocument : IDocument<TKey>;
/// <summary> /// <summary>
/// Creates an index on the given field in descending order. /// Creates an index on the given field in descending order.
/// IndexCreationOptions can be supplied to further specify /// IndexCreationOptions can be supplied to further specify
/// how the creation should be done. /// how the creation should be done.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <param name="field">The field we want to index.</param> /// <param name="field">The field we want to index.</param>
@@ -286,22 +304,25 @@ namespace MongoDbGenericRepository
where TDocument : IDocument<TKey>; where TDocument : IDocument<TKey>;
/// <summary> /// <summary>
/// Creates an index on the given field in descending order. /// Creates an index on the given field in descending order.
/// IndexCreationOptions can be supplied to further specify /// IndexCreationOptions can be supplied to further specify
/// how the creation should be done. /// how the creation should be done.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <param name="field">The field we want to index.</param> /// <param name="field">The field we want to index.</param>
/// <param name="indexCreationOptions">Options for creating an index.</param> /// <param name="indexCreationOptions">Options for creating an index.</param>
/// <param name="cancellationToken">The cancellation token.</param> /// <param name="cancellationToken">The cancellation token.</param>
/// <returns>The result of the create index operation.</returns> /// <returns>The result of the create index operation.</returns>
Task<string> CreateDescendingIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, CancellationToken cancellationToken) Task<string> CreateDescendingIndexAsync<TDocument>(
Expression<Func<TDocument, object>> field,
IndexCreationOptions indexCreationOptions,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>; where TDocument : IDocument<TKey>;
/// <summary> /// <summary>
/// Creates an index on the given field in descending order. /// Creates an index on the given field in descending order.
/// IndexCreationOptions can be supplied to further specify /// IndexCreationOptions can be supplied to further specify
/// how the creation should be done. /// how the creation should be done.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <param name="field">The field we want to index.</param> /// <param name="field">The field we want to index.</param>
@@ -311,9 +332,9 @@ namespace MongoDbGenericRepository
where TDocument : IDocument<TKey>; where TDocument : IDocument<TKey>;
/// <summary> /// <summary>
/// Creates an index on the given field in descending order. /// Creates an index on the given field in descending order.
/// IndexCreationOptions can be supplied to further specify /// IndexCreationOptions can be supplied to further specify
/// how the creation should be done. /// how the creation should be done.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <param name="field">The field we want to index.</param> /// <param name="field">The field we want to index.</param>
@@ -324,22 +345,25 @@ namespace MongoDbGenericRepository
where TDocument : IDocument<TKey>; where TDocument : IDocument<TKey>;
/// <summary> /// <summary>
/// Creates an index on the given field in descending order. /// Creates an index on the given field in descending order.
/// IndexCreationOptions can be supplied to further specify /// IndexCreationOptions can be supplied to further specify
/// how the creation should be done. /// how the creation should be done.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <param name="field">The field we want to index.</param> /// <param name="field">The field we want to index.</param>
/// <param name="indexCreationOptions">Options for creating an index.</param> /// <param name="indexCreationOptions">Options for creating an index.</param>
/// <param name="partitionKey">An optional partition key.</param> /// <param name="partitionKey">An optional partition key.</param>
/// <returns>The result of the create index operation.</returns> /// <returns>The result of the create index operation.</returns>
Task<string> CreateDescendingIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, string partitionKey) Task<string> CreateDescendingIndexAsync<TDocument>(
Expression<Func<TDocument, object>> field,
IndexCreationOptions indexCreationOptions,
string partitionKey)
where TDocument : IDocument<TKey>; where TDocument : IDocument<TKey>;
/// <summary> /// <summary>
/// Creates an index on the given field in descending order. /// Creates an index on the given field in descending order.
/// IndexCreationOptions can be supplied to further specify /// IndexCreationOptions can be supplied to further specify
/// how the creation should be done. /// how the creation should be done.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <param name="field">The field we want to index.</param> /// <param name="field">The field we want to index.</param>
@@ -347,13 +371,17 @@ namespace MongoDbGenericRepository
/// <param name="partitionKey">An optional partition key.</param> /// <param name="partitionKey">An optional partition key.</param>
/// <param name="cancellationToken">The cancellation token.</param> /// <param name="cancellationToken">The cancellation token.</param>
/// <returns>The result of the create index operation.</returns> /// <returns>The result of the create index operation.</returns>
Task<string> CreateDescendingIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, string partitionKey, CancellationToken cancellationToken) Task<string> CreateDescendingIndexAsync<TDocument>(
Expression<Func<TDocument, object>> field,
IndexCreationOptions indexCreationOptions,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>; where TDocument : IDocument<TKey>;
/// <summary> /// <summary>
/// Creates a hashed index on the given field. /// Creates a hashed index on the given field.
/// IndexCreationOptions can be supplied to further specify /// IndexCreationOptions can be supplied to further specify
/// how the creation should be done. /// how the creation should be done.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <param name="field">The field we want to index.</param> /// <param name="field">The field we want to index.</param>
@@ -362,9 +390,9 @@ namespace MongoDbGenericRepository
where TDocument : IDocument<TKey>; where TDocument : IDocument<TKey>;
/// <summary> /// <summary>
/// Creates a hashed index on the given field. /// Creates a hashed index on the given field.
/// IndexCreationOptions can be supplied to further specify /// IndexCreationOptions can be supplied to further specify
/// how the creation should be done. /// how the creation should be done.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <param name="field">The field we want to index.</param> /// <param name="field">The field we want to index.</param>
@@ -374,9 +402,9 @@ namespace MongoDbGenericRepository
where TDocument : IDocument<TKey>; where TDocument : IDocument<TKey>;
/// <summary> /// <summary>
/// Creates a hashed index on the given field. /// Creates a hashed index on the given field.
/// IndexCreationOptions can be supplied to further specify /// IndexCreationOptions can be supplied to further specify
/// how the creation should be done. /// how the creation should be done.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <param name="field">The field we want to index.</param> /// <param name="field">The field we want to index.</param>
@@ -386,22 +414,25 @@ namespace MongoDbGenericRepository
where TDocument : IDocument<TKey>; where TDocument : IDocument<TKey>;
/// <summary> /// <summary>
/// Creates a hashed index on the given field. /// Creates a hashed index on the given field.
/// IndexCreationOptions can be supplied to further specify /// IndexCreationOptions can be supplied to further specify
/// how the creation should be done. /// how the creation should be done.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <param name="field">The field we want to index.</param> /// <param name="field">The field we want to index.</param>
/// <param name="indexCreationOptions">Options for creating an index.</param> /// <param name="indexCreationOptions">Options for creating an index.</param>
/// <param name="cancellationToken">The cancellation token.</param> /// <param name="cancellationToken">The cancellation token.</param>
/// <returns>The result of the create index operation.</returns> /// <returns>The result of the create index operation.</returns>
Task<string> CreateHashedIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, CancellationToken cancellationToken) Task<string> CreateHashedIndexAsync<TDocument>(
Expression<Func<TDocument, object>> field,
IndexCreationOptions indexCreationOptions,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>; where TDocument : IDocument<TKey>;
/// <summary> /// <summary>
/// Creates a hashed index on the given field. /// Creates a hashed index on the given field.
/// IndexCreationOptions can be supplied to further specify /// IndexCreationOptions can be supplied to further specify
/// how the creation should be done. /// how the creation should be done.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <param name="field">The field we want to index.</param> /// <param name="field">The field we want to index.</param>
@@ -411,9 +442,9 @@ namespace MongoDbGenericRepository
where TDocument : IDocument<TKey>; where TDocument : IDocument<TKey>;
/// <summary> /// <summary>
/// Creates a hashed index on the given field. /// Creates a hashed index on the given field.
/// IndexCreationOptions can be supplied to further specify /// IndexCreationOptions can be supplied to further specify
/// how the creation should be done. /// how the creation should be done.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <param name="field">The field we want to index.</param> /// <param name="field">The field we want to index.</param>
@@ -424,22 +455,25 @@ namespace MongoDbGenericRepository
where TDocument : IDocument<TKey>; where TDocument : IDocument<TKey>;
/// <summary> /// <summary>
/// Creates a hashed index on the given field. /// Creates a hashed index on the given field.
/// IndexCreationOptions can be supplied to further specify /// IndexCreationOptions can be supplied to further specify
/// how the creation should be done. /// how the creation should be done.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <param name="field">The field we want to index.</param> /// <param name="field">The field we want to index.</param>
/// <param name="indexCreationOptions">Options for creating an index.</param> /// <param name="indexCreationOptions">Options for creating an index.</param>
/// <param name="partitionKey">An optional partition key.</param> /// <param name="partitionKey">An optional partition key.</param>
/// <returns>The result of the create index operation.</returns> /// <returns>The result of the create index operation.</returns>
Task<string> CreateHashedIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, string partitionKey) Task<string> CreateHashedIndexAsync<TDocument>(
Expression<Func<TDocument, object>> field,
IndexCreationOptions indexCreationOptions,
string partitionKey)
where TDocument : IDocument<TKey>; where TDocument : IDocument<TKey>;
/// <summary> /// <summary>
/// Creates a hashed index on the given field. /// Creates a hashed index on the given field.
/// IndexCreationOptions can be supplied to further specify /// IndexCreationOptions can be supplied to further specify
/// how the creation should be done. /// how the creation should be done.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <param name="field">The field we want to index.</param> /// <param name="field">The field we want to index.</param>
@@ -447,13 +481,17 @@ namespace MongoDbGenericRepository
/// <param name="partitionKey">An optional partition key.</param> /// <param name="partitionKey">An optional partition key.</param>
/// <param name="cancellationToken">The cancellation token.</param> /// <param name="cancellationToken">The cancellation token.</param>
/// <returns>The result of the create index operation.</returns> /// <returns>The result of the create index operation.</returns>
Task<string> CreateHashedIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, string partitionKey, CancellationToken cancellationToken) Task<string> CreateHashedIndexAsync<TDocument>(
Expression<Func<TDocument, object>> field,
IndexCreationOptions indexCreationOptions,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>; where TDocument : IDocument<TKey>;
/// <summary> /// <summary>
/// Creates a combined text index. /// Creates a combined text index.
/// IndexCreationOptions can be supplied to further specify /// IndexCreationOptions can be supplied to further specify
/// how the creation should be done. /// how the creation should be done.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <param name="fields">The fields we want to index.</param> /// <param name="fields">The fields we want to index.</param>
@@ -462,9 +500,9 @@ namespace MongoDbGenericRepository
where TDocument : IDocument<TKey>; where TDocument : IDocument<TKey>;
/// <summary> /// <summary>
/// Creates a combined text index. /// Creates a combined text index.
/// IndexCreationOptions can be supplied to further specify /// IndexCreationOptions can be supplied to further specify
/// how the creation should be done. /// how the creation should be done.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <param name="fields">The fields we want to index.</param> /// <param name="fields">The fields we want to index.</param>
@@ -474,9 +512,9 @@ namespace MongoDbGenericRepository
where TDocument : IDocument<TKey>; where TDocument : IDocument<TKey>;
/// <summary> /// <summary>
/// Creates a combined text index. /// Creates a combined text index.
/// IndexCreationOptions can be supplied to further specify /// IndexCreationOptions can be supplied to further specify
/// how the creation should be done. /// how the creation should be done.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <param name="fields">The fields we want to index.</param> /// <param name="fields">The fields we want to index.</param>
@@ -486,22 +524,25 @@ namespace MongoDbGenericRepository
where TDocument : IDocument<TKey>; where TDocument : IDocument<TKey>;
/// <summary> /// <summary>
/// Creates a combined text index. /// Creates a combined text index.
/// IndexCreationOptions can be supplied to further specify /// IndexCreationOptions can be supplied to further specify
/// how the creation should be done. /// how the creation should be done.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <param name="fields">The fields we want to index.</param> /// <param name="fields">The fields we want to index.</param>
/// <param name="indexCreationOptions">Options for creating an index.</param> /// <param name="indexCreationOptions">Options for creating an index.</param>
/// <param name="cancellationToken">The cancellation token.</param> /// <param name="cancellationToken">The cancellation token.</param>
/// <returns>The result of the create index operation.</returns> /// <returns>The result of the create index operation.</returns>
Task<string> CreateCombinedTextIndexAsync<TDocument>(IEnumerable<Expression<Func<TDocument, object>>> fields, IndexCreationOptions indexCreationOptions, CancellationToken cancellationToken) Task<string> CreateCombinedTextIndexAsync<TDocument>(
IEnumerable<Expression<Func<TDocument, object>>> fields,
IndexCreationOptions indexCreationOptions,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>; where TDocument : IDocument<TKey>;
/// <summary> /// <summary>
/// Creates a combined text index. /// Creates a combined text index.
/// IndexCreationOptions can be supplied to further specify /// IndexCreationOptions can be supplied to further specify
/// how the creation should be done. /// how the creation should be done.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <param name="fields">The fields we want to index.</param> /// <param name="fields">The fields we want to index.</param>
@@ -511,35 +552,41 @@ namespace MongoDbGenericRepository
where TDocument : IDocument<TKey>; where TDocument : IDocument<TKey>;
/// <summary> /// <summary>
/// Creates a combined text index. /// Creates a combined text index.
/// IndexCreationOptions can be supplied to further specify /// IndexCreationOptions can be supplied to further specify
/// how the creation should be done. /// how the creation should be done.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <param name="fields">The fields we want to index.</param> /// <param name="fields">The fields we want to index.</param>
/// <param name="partitionKey">An optional partition key.</param> /// <param name="partitionKey">An optional partition key.</param>
/// <param name="cancellationToken">The cancellation token.</param> /// <param name="cancellationToken">The cancellation token.</param>
/// <returns>The result of the create index operation.</returns> /// <returns>The result of the create index operation.</returns>
Task<string> CreateCombinedTextIndexAsync<TDocument>(IEnumerable<Expression<Func<TDocument, object>>> fields, string partitionKey, CancellationToken cancellationToken) Task<string> CreateCombinedTextIndexAsync<TDocument>(
IEnumerable<Expression<Func<TDocument, object>>> fields,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>; where TDocument : IDocument<TKey>;
/// <summary> /// <summary>
/// Creates a combined text index. /// Creates a combined text index.
/// IndexCreationOptions can be supplied to further specify /// IndexCreationOptions can be supplied to further specify
/// how the creation should be done. /// how the creation should be done.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <param name="fields">The fields we want to index.</param> /// <param name="fields">The fields we want to index.</param>
/// <param name="indexCreationOptions">Options for creating an index.</param> /// <param name="indexCreationOptions">Options for creating an index.</param>
/// <param name="partitionKey">An optional partition key.</param> /// <param name="partitionKey">An optional partition key.</param>
/// <returns>The result of the create index operation.</returns> /// <returns>The result of the create index operation.</returns>
Task<string> CreateCombinedTextIndexAsync<TDocument>(IEnumerable<Expression<Func<TDocument, object>>> fields, IndexCreationOptions indexCreationOptions, string partitionKey) Task<string> CreateCombinedTextIndexAsync<TDocument>(
IEnumerable<Expression<Func<TDocument, object>>> fields,
IndexCreationOptions indexCreationOptions,
string partitionKey)
where TDocument : IDocument<TKey>; where TDocument : IDocument<TKey>;
/// <summary> /// <summary>
/// Creates a combined text index. /// Creates a combined text index.
/// IndexCreationOptions can be supplied to further specify /// IndexCreationOptions can be supplied to further specify
/// how the creation should be done. /// how the creation should be done.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <param name="fields">The fields we want to index.</param> /// <param name="fields">The fields we want to index.</param>
@@ -547,11 +594,15 @@ namespace MongoDbGenericRepository
/// <param name="partitionKey">An optional partition key.</param> /// <param name="partitionKey">An optional partition key.</param>
/// <param name="cancellationToken">The cancellation token.</param> /// <param name="cancellationToken">The cancellation token.</param>
/// <returns>The result of the create index operation.</returns> /// <returns>The result of the create index operation.</returns>
Task<string> CreateCombinedTextIndexAsync<TDocument>(IEnumerable<Expression<Func<TDocument, object>>> fields, IndexCreationOptions indexCreationOptions, string partitionKey, CancellationToken cancellationToken) Task<string> CreateCombinedTextIndexAsync<TDocument>(
IEnumerable<Expression<Func<TDocument, object>>> fields,
IndexCreationOptions indexCreationOptions,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>; where TDocument : IDocument<TKey>;
/// <summary> /// <summary>
/// Drops the index given a field name /// Drops the index given a field name
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <param name="indexName">The name of the index</param> /// <param name="indexName">The name of the index</param>
@@ -559,7 +610,7 @@ namespace MongoDbGenericRepository
where TDocument : IDocument<TKey>; where TDocument : IDocument<TKey>;
/// <summary> /// <summary>
/// Drops the index given a field name /// Drops the index given a field name
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <param name="indexName">The name of the index</param> /// <param name="indexName">The name of the index</param>
@@ -568,7 +619,7 @@ namespace MongoDbGenericRepository
where TDocument : IDocument<TKey>; where TDocument : IDocument<TKey>;
/// <summary> /// <summary>
/// Drops the index given a field name /// Drops the index given a field name
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <param name="indexName">The name of the index</param> /// <param name="indexName">The name of the index</param>
@@ -577,7 +628,7 @@ namespace MongoDbGenericRepository
where TDocument : IDocument<TKey>; where TDocument : IDocument<TKey>;
/// <summary> /// <summary>
/// Drops the index given a field name /// Drops the index given a field name
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <param name="indexName">The name of the index</param> /// <param name="indexName">The name of the index</param>