Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add transactional adapter support for mongoose #154

Closed
GO-DIE opened this issue Jun 24, 2024 · 4 comments · Fixed by #159
Closed

Add transactional adapter support for mongoose #154

GO-DIE opened this issue Jun 24, 2024 · 4 comments · Fixed by #159
Labels
enhancement New feature or request

Comments

@GO-DIE
Copy link

GO-DIE commented Jun 24, 2024

mongoose is a popular mongodb client package that is used by many people including myself, and I am eager to add an official transactional adapter to mongoose.

@GO-DIE GO-DIE changed the title Add adapter support for mongoose Add transactional adapter support for mongoose Jun 24, 2024
@Papooch Papooch added the enhancement New feature or request label Jun 24, 2024
@Papooch
Copy link
Owner

Papooch commented Jun 24, 2024

Hi, I was planning to add support for plain mongodb at some point (or welcome a contribution).

In terms of mongoose - I don't know if you're aware, but they offer a built-in transaction propagation with AsyncLocalStorage (i.e. the very same thing that a @nestjs-cls/transactional plugin would offer, so the only benefit would be the option to use the @Transactional decorator)

@GO-DIE
Copy link
Author

GO-DIE commented Jun 24, 2024

Hi, I was planning to add support for plain mongodb at some point (or welcome a contribution).

In terms of mongoose - I don't know if you're aware, but they offer a built-in transaction propagation with AsyncLocalStorage (i.e. the very same thing that a @nestjs-cls/transactional plugin would offer, so the only benefit would be the option to use the @Transactional decorator)

Yes, I understand, but I don't think there is a conflict because mongoose's support for AsyncLocalStorage makes us easier to provide a transaction adapter for us to use the @transactional decorator feature.

@Papooch
Copy link
Owner

Papooch commented Jun 24, 2024

@GO-DIE Would you like to have a go at implementing it? I am definitely open to contributions.

@Papooch
Copy link
Owner

Papooch commented Jul 1, 2024

I found some free time and put together a mongoose adapter. Feel free to test it for your use-case.

@nestjs-cls/transactional >= 2.4.0 is required.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants