-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(NODE-3344): allow setting
defaultTransactionOptions
with POJO r…
…ather than ReadConcern instance (#3032) Co-authored-by: Valeri Karpov <[email protected]>
- Loading branch information
Showing
2 changed files
with
19 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { expectType, expectError } from 'tsd'; | ||
import { MongoClient } from '../../src/mongo_client'; | ||
import { ReadConcern, ReadConcernLevel } from '../../src/read_concern'; | ||
import type { ClientSession } from '../../src/sessions'; | ||
|
||
// test mapped cursor types | ||
const client = new MongoClient(''); | ||
// should allow ReadConcern or ReadConcernLike as readConcern in defaultTransactionOptions | ||
expectType<ClientSession>( | ||
client.startSession({ defaultTransactionOptions: { readConcern: { level: 'snapshot' } } }) | ||
); | ||
expectType<ClientSession>( | ||
client.startSession({ | ||
defaultTransactionOptions: { readConcern: new ReadConcern(ReadConcernLevel.local) } | ||
}) | ||
); | ||
expectError(client.startSession({ defaultTransactionOptions: { readConcern: 1 } })); |