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
Use MongoDB.Driver library for building MongoDB connection string
support4de495012abd
diff --git a/src/Web/Grand.Web/Controllers/InstallController.cs b/src/Web/Grand.Web/Controllers/InstallController.csindex 9b546e412..1ee7398bf 100644--- a/src/Web/Grand.Web/Controllers/InstallController.cs+++ b/src/Web/Grand.Web/Controllers/InstallController.cs@@ -140,11 +140,13 @@ namespace Grand.Web.Controllersif (string.IsNullOrEmpty(model.MongoDBServerName))ModelState.AddModelError("", locService.GetResource(model.SelectedLanguage, "MongoDBServerNameRequired"));- var userNameandPassword = "";- if (!string.IsNullOrEmpty(model.MongoDBUsername))- userNameandPassword = model.MongoDBUsername + ":" + model.MongoDBPassword + "@";-- connectionString = "mongodb://" + userNameandPassword + model.MongoDBServerName + "/" + model.MongoDBDatabaseName;+ var builder = new MongoDB.Driver.MongoUrlBuilder {+ Server = new MongoDB.Driver.MongoServerAddress(model.MongoDBServerName),+ Username = model.MongoDBUsername,+ Password = model.MongoDBPassword,+ DatabaseName = model.MongoDBDatabaseName+ };+ connectionString = builder.ToString();}else{diff --git a/src/Web/Grand.Web/Views/Install/Index.cshtml b/src/Web/Grand.Web/Views/Install/Index.cshtmlindex 3c24f978d..1c885052a 100644--- a/src/Web/Grand.Web/Views/Install/Index.cshtml+++ b/src/Web/Grand.Web/Views/Install/Index.cshtml@@ -178,7 +178,7 @@</span><span class="hint">@LocalizedService.GetResource(Model.SelectedLanguage, "Example"):<br />- For MongoDB: @Html.Raw("mongodb://[username:password@]host1[:port1]/databaseName")+ For MongoDB: @Html.Raw("mongodb+srv://<username>:<password>@cluster0.abc.mongodb.net/?retryWrites=true&w=majority")(Find more info <a href="https://docs.mongodb.org/manual/reference/connection-string/" target="_blank">here</a>)</span></div>