|
|
|
@ -9,6 +9,7 @@ using System.Threading; |
|
|
|
using System.Threading.Tasks; |
|
|
|
using MongoDB.Bson; |
|
|
|
using MongoDB.Driver; |
|
|
|
using MongoDB.Driver.Core.Clusters; |
|
|
|
using Squidex.Infrastructure.MongoDb; |
|
|
|
|
|
|
|
namespace Squidex.Infrastructure.EventSourcing |
|
|
|
@ -31,7 +32,7 @@ namespace Squidex.Infrastructure.EventSourcing |
|
|
|
get { return Collection; } |
|
|
|
} |
|
|
|
|
|
|
|
public bool IsReplicaSet { get; } |
|
|
|
public bool IsReplicaSet { get; private set; } |
|
|
|
|
|
|
|
public MongoEventStore(IMongoDatabase database, IEventNotifier notifier) |
|
|
|
: base(database) |
|
|
|
@ -51,9 +52,9 @@ namespace Squidex.Infrastructure.EventSourcing |
|
|
|
return new MongoCollectionSettings { WriteConcern = WriteConcern.WMajority }; |
|
|
|
} |
|
|
|
|
|
|
|
protected override Task SetupCollectionAsync(IMongoCollection<MongoEventCommit> collection, CancellationToken ct = default) |
|
|
|
protected override async Task SetupCollectionAsync(IMongoCollection<MongoEventCommit> collection, CancellationToken ct = default) |
|
|
|
{ |
|
|
|
return collection.Indexes.CreateManyAsync(new[] |
|
|
|
await collection.Indexes.CreateManyAsync(new[] |
|
|
|
{ |
|
|
|
new CreateIndexModel<MongoEventCommit>( |
|
|
|
Index |
|
|
|
@ -75,6 +76,8 @@ namespace Squidex.Infrastructure.EventSourcing |
|
|
|
Unique = true |
|
|
|
}) |
|
|
|
}, ct); |
|
|
|
|
|
|
|
IsReplicaSet = Database.Client.Cluster.Description.Type == ClusterType.ReplicaSet; |
|
|
|
} |
|
|
|
} |
|
|
|
} |