Skip to content

Commit 884abda

Browse files
authored
Merge pull request #1718 from dgomezc/1717-FailedMongoDBService
Fix Cosmos MongoDB services in all backend framework
2 parents 0ed54e2 + 656bec8 commit 884abda

File tree

4 files changed

+7
-3
lines changed

4 files changed

+7
-3
lines changed

templates/Web/_composition/AspNet/Feature.AspNet.Azure.Cosmos.Mongo/backend/Startup_postaction.cs

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ private IMongoClient InitializeCosmosClientInstance()
3434

3535
settings.UseTls = true;
3636
settings.SslSettings = new SslSettings() { EnabledSslProtocols = SslProtocols.Tls12 };
37+
settings.RetryWrites = false;
3738

3839
return new MongoClient(settings);
3940
}

templates/Web/_composition/Flask/Feature.Flask.Azure.Cosmos.Mongo/backend/mongo/mongo_client.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88

99

10-
client = MongoClient(connection_str + '?ssl=true&replicaSet=globaldb')
10+
client = MongoClient(connection_str + '?ssl=true&replicaSet=globaldb&retryWrites=false')
1111

1212
db = client[CONSTANTS['COSMOS']['COLLECTION']]
1313

templates/Web/_composition/MoleculerJS/Feature.Moleculer.Azure.Cosmos.Mongo/backend/mixins/db.mixin.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ module.exports = opt => {
1919
password: process.env.COSMOSDB_PASSWORD
2020
},
2121
useNewUrlParser: true,
22-
useUnifiedTopology: true
22+
useUnifiedTopology: true,
23+
retryWrites: false
2324
}
2425
),
2526
// Set DB collection name

templates/Web/_composition/NodeJS/Feature.Node.Azure.Cosmos.Mongo/backend/mongo/mongoConnect.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ function connect() {
1111
user: process.env.COSMOSDB_USER,
1212
password: process.env.COSMOSDB_PASSWORD
1313
},
14-
useNewUrlParser: true
14+
useNewUrlParser: true,
15+
useUnifiedTopology: true,
16+
retryWrites: false
1517
})
1618
.then(() => console.log("Connection to CosmosDB successful"))
1719
.catch(err => console.error(err));

0 commit comments

Comments
 (0)