Automattic / Automattic/mongoose

[Request] Session event emission

Open
#10,477 0 comments 1 reaction 0 assignees View on GitHub
enhancement
Dominant language
JavaScript
Stars
27.5k
Forks
4k
Avg merge
2d 7h
Merged PRs (30d)
35

Description

Emit different event by the clientSession.

Currently there is only a flag `hasEnded` in the document `$session` indicating if the current session is still ongoing or not.
forcing to check at regular interval for the change of flag if there is need to do action **after** a transaction has been committed or not.

**What is the expected behavior?**

It would be much easier if the `$session` was en eventEmitter, it could emit event type `end|committed|closed|aborted` etc...

**What are the versions of Node.js, Mongoose and MongoDB you are using? Note that "latest" is not a version.**
`node v 15.5.1, mongoose v 5.9.24`

Contributor guide

Open the contributing guide

Research direction

Start by tracing the Mongoose $session transaction lifecycle and the existing hasEnded flag; the issue names no source file, entry point, or test. Define the event contract for session end, commit, close, and abort, then verify that consumers can reliably observe each outcome after transaction completion.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, mongodb, node.js
Domain
backend, databases
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.