File tree Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Original file line number Diff line number Diff line change 11import { ReadPreference } from './read_preference' ;
22import { MongoRuntimeError , MongoTransactionError } from './error' ;
3- import { ReadConcern } from './read_concern' ;
3+ import { ReadConcern , ReadConcernLike } from './read_concern' ;
44import { WriteConcern } from './write_concern' ;
55import type { Server } from './sdam/server' ;
66import type { CommandOperationOptions } from './operations/command' ;
@@ -63,7 +63,7 @@ const COMMITTED_STATES: Set<TxnState> = new Set([
6363export interface TransactionOptions extends CommandOperationOptions {
6464 // TODO(NODE-3344): These options use the proper class forms of these settings, it should accept the basic enum values too
6565 /** A default read concern for commands in this transaction */
66- readConcern ?: ReadConcern ;
66+ readConcern ?: ReadConcernLike ;
6767 /** A default writeConcern for commands in this transaction */
6868 writeConcern ?: WriteConcern ;
6969 /** A default read preference for commands in this transaction */
Original file line number Diff line number Diff line change 1+ import { expectType , expectError } from 'tsd' ;
2+ import { MongoClient } from '../../src/mongo_client' ;
3+ import { ReadConcern , ReadConcernLevel } from '../../src/read_concern' ;
4+ import type { ClientSession } from '../../src/sessions' ;
5+
6+ // test mapped cursor types
7+ const client = new MongoClient ( '' ) ;
8+ // should allow ReadConcern or ReadConcernLike as readConcern in defaultTransactionOptions
9+ expectType < ClientSession > (
10+ client . startSession ( { defaultTransactionOptions : { readConcern : { level : 'snapshot' } } } )
11+ ) ;
12+ expectType < ClientSession > (
13+ client . startSession ( {
14+ defaultTransactionOptions : { readConcern : new ReadConcern ( ReadConcernLevel . local ) }
15+ } )
16+ ) ;
17+ expectError ( client . startSession ( { defaultTransactionOptions : { readConcern : 1 } } ) ) ;
You can’t perform that action at this time.
0 commit comments