-
Notifications
You must be signed in to change notification settings - Fork 535
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add DirectConnection Option in MongoDB SDK (#15968)
We currently have a ReplicaSetNoPrimary error caused by MongoServerSelectionError: connection timed out\n {"reason"=>{"type"=>"ReplicaSetNoPrimary", "servers"=>{}, "stale"=>"REDACTED", "compatible"=>"REDACTED", "heartbeatFrequencyMS"=>"REDACTED", "localThresholdMS"=>"REDACTED", "setName"=>"REDACTED", "maxElectionId"=>nil, "maxSetVersion"=>"REDACTED", "commonWireVersion"=>"REDACTED", "logicalSessionTimeoutMinutes"=>nil}, "name"=>"MongoServerSelectionError", "message"=>"connection timed out", "stack"=>"MongoServerSelectionError: connection timed out\n at Timeout._onTimeout (/usr/src/server/bundle/alfred/www.js:126365:34)\n at listOnTimeout (node:internal/timers:559:17)\n at processTimers (node:internal/timers:502:7)"} From: https://stackoverflow.com/questions/59162342/mongodb-connection-error-mongotimeouterror-server-selection-timed-out-after-30, we can fix it by enabling directConnection flag as true. Here is the definition for directConnection: https://mongodb.github.io/node-mongodb-native/4.14/interfaces/MongoClientOptions.html#directConnection
- Loading branch information
1 parent
a51cd2a
commit 58c6203
Showing
4 changed files
with
8 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters