You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: docs/reference/content/reference/unified-topology/index.md
+5-1
Original file line number
Diff line number
Diff line change
@@ -13,6 +13,7 @@ title = "Unified Topology Design"
13
13
At the time of writing the node driver has seven topology classes, including the newly introduced unified topology. Each legacy topology type from the core module targets a supported topology class: Replica Sets, Sharded Deployments (mongos) and Standalone servers. On top of each of these rests a thin topology wrapper from the "native" layer which introduces the concept of a "disconnect handler", essentially a callback queue for handling naive retryability.
14
14
15
15
The goal of the unified topology is threefold:
16
+
16
17
- fully support the drivers Server Discovery and Monitoring, Server Selection and Max Staleness specifications
17
18
- reduce the maintenance burden of supporting the topology layer in the driver by modeling all supported topology types with a single engine
18
19
- remove confusing functionality which could be potentially dangerous for our users
The unified topology no longer supports the following events:
36
+
35
37
-`reconnect`
36
38
-`reconnectFailed`
37
39
-`attemptReconnect`
@@ -44,12 +46,13 @@ The unified topology no longer supports the following events:
44
46
-`open`
45
47
46
48
It also deprecates the following options passed into the `MongoClient`:
49
+
47
50
-`autoReconnect`
48
51
-`reconnectTries`
49
52
-`reconnectInterval`
50
53
-`bufferMaxEntries`
51
54
52
-
The following sections will go into detail about why tese values are no longer used.
55
+
The following sections will go into detail about why these values are no longer used.
53
56
54
57
### `MongoClient.connect`, `isConnected`
55
58
@@ -98,6 +101,7 @@ The `serverSelection` method above will loop for up to `serverSelectionTimeoutMS
98
101
### disconnectHandler
99
102
100
103
The three topology types from the "native" layer (in `lib/topologies`) primarily provide support for a callback store, called the "disconnect handler". Rather than using a server selection loop, the legacy topologies instead place callbacks on this store in cases when no suitable server is available, intending to run the operation at some later time. This callback store also provides a form of naive retryability, however in practice this might lead to unexpected, or even unintended results:
104
+
101
105
- The callback store is only associated with a single server, so attempts to re-execute an operation are only ever made against the originally selected server. If that server never comes back (it was stepped down, and decommissioned for instance), the operation will sit in limbo.
102
106
- There is no collaboration with the server to ensure that queued write operations only happen one time. Imagine running an `updateOne` operation which is interrupted by a network error. The operation was successfully sent to the server, but the server response was lost during the interruption, which means the operation is placed in the callback store to be retried. At the same, another microservice allows a user to update the written data. Once the original client is reconnected to the server, it automatically rexecutes the operation and updates the _newer_ data with an _older_ value.
0 commit comments