Open-source eCommerce platform for C# and ASP.NET Core 10 with MongoDB. Build multi-store shops and multi-vendor marketplaces with B2B/B2C, REST API, plugins, Vue 3 and Docker.
C# aspnet-corecsharpdockerdotnetecommerceecommerce-platformmongodbmulti-storemulti-vendornosqlonline-shopshoppingcart
Prevent for exception during create index on the table
KrzysztofPajakd27da2658823
diff --git a/src/Core/Grand.Domain/Data/Mongo/MongoDBContext.cs b/src/Core/Grand.Domain/Data/Mongo/MongoDBContext.csindex 83c4388f7..f37ba0725 100644--- a/src/Core/Grand.Domain/Data/Mongo/MongoDBContext.cs+++ b/src/Core/Grand.Domain/Data/Mongo/MongoDBContext.cs@@ -120,8 +120,12 @@ namespace Grand.Domain.Data.Mongo}}- await ((MongoRepository<T>)repository).Collection.Indexes.CreateOneAsync(new CreateIndexModel<T>(Builders<T>.IndexKeys.Combine(keys),- new CreateIndexOptions() { Name = indexName, Unique = unique }));+ try+ {+ await ((MongoRepository<T>)repository).Collection.Indexes.CreateOneAsync(new CreateIndexModel<T>(Builders<T>.IndexKeys.Combine(keys),+ new CreateIndexOptions() { Name = indexName, Unique = unique }));+ }+ catch { }}}}