Skip to content

Commit

Permalink
fix: add directConnection options to MongoDB connection (#9955)
Browse files Browse the repository at this point in the history
Co-authored-by: afournier <afournier@solocal.com>
  • Loading branch information
a-fournier and afournier committed Apr 17, 2023
1 parent 68aa573 commit e0165e7
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/data-source-options.md
Expand Up @@ -506,6 +506,8 @@ Different RDBMS-es have their own specific options.

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

- `directConnection` - Specifies whether to force dispatch all operations to the specified host.

## `sql.js` data source options

- `database`: The raw UInt8Array database that should be imported.
Expand Down
2 changes: 2 additions & 0 deletions docs/zh_CN/connection-options.md
Expand Up @@ -375,6 +375,8 @@

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

- `directConnection` - 指定是否强制将所有操作分派到指定的主机。

> 注: 由于译者对MongoDB理解不够深入,故一些翻译直接使用了机翻,因此会有些词不达意,如有更好的翻译选项,请提交PR进行完善。
## `sql.js`
Expand Down
5 changes: 5 additions & 0 deletions src/driver/mongodb/MongoConnectionOptions.ts
Expand Up @@ -46,6 +46,11 @@ export interface MongoConnectionOptions extends BaseDataSourceOptions {
*/
readonly database?: string

/**
* Specifies whether to force dispatch all operations to the specified host. Default: false
*/
readonly directConnection?: boolean

/**
* The driver object
* This defaults to require("mongodb")
Expand Down
1 change: 1 addition & 0 deletions src/driver/mongodb/MongoDriver.ts
Expand Up @@ -217,6 +217,7 @@ export class MongoDriver implements Driver {
"useUnifiedTopology",
"autoEncryption",
"retryWrites",
"directConnection",
]

cteCapabilities: CteCapabilities = {
Expand Down

0 comments on commit e0165e7

Please sign in to comment.