Skip to content
This repository has been archived by the owner on Feb 4, 2022. It is now read-only.

Commit

Permalink
fix(sessions): add toBSON method to ClientSession
Browse files Browse the repository at this point in the history
Fixes NODE-1518
  • Loading branch information
kvwalker committed Jun 25, 2018
1 parent c4add26 commit d95a4d1
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/sessions.js
Expand Up @@ -220,6 +220,10 @@ class ClientSession extends EventEmitter {
);
});
}

toBSON() {
throw new Error('ClientSession cannot be serialized to BSON.');
}
}

function endTransaction(session, commandName, callback) {
Expand Down

3 comments on commit d95a4d1

@vkarpov15
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At a high level this makes sense and I don't have any ideas how to improve this. Just want to point out that the downstream impact isn't pleasant for people looking to print out their options: Automattic/mongoose@fc76fe4 .

@daprahamian
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vkarpov15 I didn't realize that mongoose implemented a custom print function for this. What is the goal of printing out the BSON version instead of the raw options?

@vkarpov15
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.