Skip to content

Commit

Permalink
make typescript happy
Browse files Browse the repository at this point in the history
  • Loading branch information
dariakp committed Jul 9, 2021
1 parent 143e41a commit e89a431
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/sessions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ class ClientSession extends TypedEventEmitter<ClientSessionEvents> {
transaction: Transaction;
/** @internal */
[kServerSession]?: ServerSession;
/** @internal */
[kSnapshotTime]?: Timestamp;
/** @internal */
[kSnapshotEnabled] = false;
Expand Down Expand Up @@ -140,13 +141,10 @@ class ClientSession extends TypedEventEmitter<ClientSessionEvents> {

this[kSnapshotEnabled] = true;
if (options.causalConsistency === true) {
// TODO: throw validation error; MongoDriverError or more specific
throw new MongoDriverError(
'Properties "causalConsistency" and "snapshot" are mutually exclusive'
);
}

// TODO(NODE-3394): also validate server version >= 5.0
}

this.topology = topology;
Expand Down Expand Up @@ -283,7 +281,6 @@ class ClientSession extends TypedEventEmitter<ClientSessionEvents> {
*/
startTransaction(options?: TransactionOptions): void {
if (this[kSnapshotEnabled]) {
// TODO: should this be a different type?
throw new MongoDriverError('Transactions are not allowed with snapshot sessions');
}

Expand Down Expand Up @@ -849,7 +846,7 @@ function applySession(
command.readConcern = command.readConcern || {};
Object.assign(command.readConcern, { afterClusterTime: session.operationTime });
} else if (session[kSnapshotEnabled]) {
command.readConcern = command.readConcern || { level: ReadConcernLevel.snapshot }; // TODO: is there a better place to set this?
command.readConcern = command.readConcern || { level: ReadConcernLevel.snapshot };
if (session[kSnapshotTime] !== undefined) {
Object.assign(command.readConcern, { atClusterTime: session[kSnapshotTime] });
}
Expand Down

0 comments on commit e89a431

Please sign in to comment.