Skip to content

Commit

Permalink
Update MongoClientHelpers.cs
Browse files Browse the repository at this point in the history
Try DirectConnection true
  • Loading branch information
jas88 committed Oct 24, 2024
1 parent 391892f commit 69502c3
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/SmiServices/Common/MongoDB/MongoClientHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ public static MongoClient GetMongoClient(MongoDbOptions options, string applicat
{
ApplicationName = applicationName,
Server = new MongoServerAddress(options.HostName, options.Port),
WriteConcern = new WriteConcern(journal: !skipJournal)
WriteConcern = new WriteConcern(journal: !skipJournal),
DirectConnection = true
});

if (string.IsNullOrWhiteSpace(options.Password))
Expand All @@ -47,7 +48,8 @@ public static MongoClient GetMongoClient(MongoDbOptions options, string applicat
ApplicationName = applicationName,
Credential = credentials,
Server = new MongoServerAddress(options.HostName, options.Port),
WriteConcern = new WriteConcern(journal: !skipJournal)
WriteConcern = new WriteConcern(journal: !skipJournal),
DirectConnection = true
};

var client = new MongoClient(mongoClientSettings);
Expand Down

0 comments on commit 69502c3

Please sign in to comment.