|
|
@ -12,6 +12,8 @@ using MongoDB.Bson; |
|
|
using MongoDB.Driver; |
|
|
using MongoDB.Driver; |
|
|
using Squidex.Infrastructure.States; |
|
|
using Squidex.Infrastructure.States; |
|
|
|
|
|
|
|
|
|
|
|
#pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body
|
|
|
|
|
|
|
|
|
namespace Squidex.Infrastructure.MongoDb |
|
|
namespace Squidex.Infrastructure.MongoDb |
|
|
{ |
|
|
{ |
|
|
public static class MongoExtensions |
|
|
public static class MongoExtensions |
|
|
@ -37,6 +39,18 @@ namespace Squidex.Infrastructure.MongoDb |
|
|
return true; |
|
|
return true; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static async Task TryDropOneAsync<T>(this IMongoIndexManager<T> indexes, string name) |
|
|
|
|
|
{ |
|
|
|
|
|
try |
|
|
|
|
|
{ |
|
|
|
|
|
await indexes.DropOneAsync(name); |
|
|
|
|
|
} |
|
|
|
|
|
catch |
|
|
|
|
|
{ |
|
|
|
|
|
/* NOOP */ |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
public static IFindFluent<TDocument, BsonDocument> Only<TDocument>(this IFindFluent<TDocument, TDocument> find, |
|
|
public static IFindFluent<TDocument, BsonDocument> Only<TDocument>(this IFindFluent<TDocument, TDocument> find, |
|
|
Expression<Func<TDocument, object>> include) |
|
|
Expression<Func<TDocument, object>> include) |
|
|
{ |
|
|
{ |
|
|
|