Skip to content

Commit

Permalink
Updated MongoDB Driver to 3.0.0 (#145)
Browse files Browse the repository at this point in the history
  • Loading branch information
glen-84 authored Nov 4, 2024
1 parent e789b03 commit b16b780
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/Mongo/Mongo.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="MongoDB.Driver" Version="2.28.0" />
<PackageReference Include="MongoDB.Driver" Version="3.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
6 changes: 3 additions & 3 deletions src/Mongo/MongoReplicaSetResource.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
using System;
using System;
using System.Threading.Tasks;
using MongoDB.Bson;
using MongoDB.Driver;

namespace Squadron
{
/// <inheritdoc/>
/// <inheritdoc/>
public class MongoReplicaSetResource : MongoReplicaSetResource<MongoReplicaSetDefaultOptions> { }

/// <summary>
Expand All @@ -19,7 +19,7 @@ public class MongoReplicaSetResource<TOptions> :
public override async Task InitializeAsync()
{
await base.InitializeAsync();
var client = new MongoClient(ConnectionString + "/?connect=direct");
var client = new MongoClient(ConnectionString);
BsonDocument rsConfig = CreateReplicaSetConfiguration();
var command = new BsonDocumentCommand<BsonDocument>(new BsonDocument
{
Expand Down
5 changes: 3 additions & 2 deletions src/Mongo/MongoResource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ public override async Task InitializeAsync()
{
await base.InitializeAsync();
ConnectionString =
$"mongodb://{Manager.Instance.Address}:{Manager.Instance.HostPort}";
$"mongodb://{Manager.Instance.Address}:{Manager.Instance.HostPort}" +
"/?directConnection=true";

_client = GetClient();
await Initializer.WaitAsync(new MongoStatus(_client));
Expand All @@ -43,7 +44,7 @@ private MongoClient GetClient()
{
return new MongoClient(new MongoClientSettings
{
ConnectionMode = ConnectionMode.Direct,
DirectConnection = true,
ReadConcern = ReadConcern.Majority,
WriteConcern = WriteConcern.Acknowledged,
Server = new MongoServerAddress(Manager.Instance.Address, Manager.Instance.HostPort),
Expand Down

0 comments on commit b16b780

Please sign in to comment.