Skip to content

Commit e0165e7

Browse files
a-fournierafournier
andauthored
fix: add directConnection options to MongoDB connection (#9955)
Co-authored-by: afournier <[email protected]>
1 parent 68aa573 commit e0165e7

File tree

4 files changed

+10
-0
lines changed

4 files changed

+10
-0
lines changed

docs/data-source-options.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,8 @@ Different RDBMS-es have their own specific options.
506506

507507
- `authMechanism` - Sets the authentication mechanism that MongoDB will use to authenticate the connection.
508508

509+
- `directConnection` - Specifies whether to force dispatch all operations to the specified host.
510+
509511
## `sql.js` data source options
510512

511513
- `database`: The raw UInt8Array database that should be imported.

docs/zh_CN/connection-options.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,8 @@
375375

376376
- `authMechanism` - 设置MongoDB用于验证连接的身份验证机制。
377377

378+
- `directConnection` - 指定是否强制将所有操作分派到指定的主机。
379+
378380
> 注: 由于译者对MongoDB理解不够深入,故一些翻译直接使用了机翻,因此会有些词不达意,如有更好的翻译选项,请提交PR进行完善。
379381
380382
## `sql.js`

src/driver/mongodb/MongoConnectionOptions.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@ export interface MongoConnectionOptions extends BaseDataSourceOptions {
4646
*/
4747
readonly database?: string
4848

49+
/**
50+
* Specifies whether to force dispatch all operations to the specified host. Default: false
51+
*/
52+
readonly directConnection?: boolean
53+
4954
/**
5055
* The driver object
5156
* This defaults to require("mongodb")

src/driver/mongodb/MongoDriver.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ export class MongoDriver implements Driver {
217217
"useUnifiedTopology",
218218
"autoEncryption",
219219
"retryWrites",
220+
"directConnection",
220221
]
221222

222223
cteCapabilities: CteCapabilities = {

0 commit comments

Comments
 (0)