mirror of
https://github.com/Alex-Rachel/TEngine.git
synced 2025-08-14 16:51:28 +00:00
IDataBase Last
IDataBase Last
This commit is contained in:
@@ -190,6 +190,18 @@ public sealed class MongoDataBase : IDateBase
|
||||
return await cursor.FirstOrDefaultAsync();
|
||||
}
|
||||
}
|
||||
|
||||
public async FTask<T> Last<T>(Expression<Func<T, bool>> filter, string collection = null) where T : Entity
|
||||
{
|
||||
using (await _mongoDataBaseLock.Lock(RandomHelper.RandInt64()))
|
||||
{
|
||||
var cursor = await GetCollection<T>(collection).FindAsync(filter);
|
||||
|
||||
var list = await cursor.ToListAsync();
|
||||
|
||||
return list.LastOrDefault();
|
||||
}
|
||||
}
|
||||
|
||||
public async FTask<List<T>> QueryOrderBy<T>(Expression<Func<T, bool>> filter, Expression<Func<T, object>> orderByExpression, bool isAsc = true, string collection = null) where T : Entity
|
||||
{
|
||||
|
Reference in New Issue
Block a user