You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
1.2 KiB

using BukiVedi.Shared.Entities;
using MongoDB.Driver;
namespace BukiVedi.Shared
{
public interface IRepository<T>
where T : IEntity
{
internal IMongoCollection<T> Collection { get; }
Task<IEnumerable<TOutput>> Aggregate<TOutput>(PipelineDefinition<T, TOutput> pipeline);
Task<T> GetById(string id);
Task<T[]> GetAll();
Task<T[]> Get(FilterDefinition<T> predicate);
Task<T> GetLast(FilterDefinition<T> predicate, string sortField);
Task<long> Count(FilterDefinition<T> predicate);
Task<bool> Exists(FilterDefinition<T> filter);
Task<bool> ExistById(string id);
T[] GetRandomDocuments(int count);
Task<T> Write(T obj);
Task<IEnumerable<T>> Write(IEnumerable<T> batch);
Task<T> WriteOrGetExists(T record, FilterDefinition<T> filter);
Task<T> ModifyOne(FilterDefinition<T> filter, UpdateDefinition<T> update);
Task<UpdateResult> Modify(FilterDefinition<T> filter, UpdateDefinition<T> update);
Task<T> ReWrite(T record);
Task<bool> TryRemove(T obj);
Task<bool> TryRemove(FilterDefinition<T> filter);
Task<bool> TryRemoveById(string id);
internal Task Drop();
}
}

Powered by TurnKey Linux.