-
-
Notifications
You must be signed in to change notification settings - Fork 535
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
mongodb: transparently disable transactions while allowing use in code #3992
Labels
enhancement
New feature or request
Comments
FYI you can have a replica set with in-memory mongodb too. https://github.com/nodkz/mongodb-memory-server#replica-set-start Kind of a duplicate of #3747, we could support both if we design this properly. |
B4nan
added a commit
that referenced
this issue
Apr 23, 2023
Is it now possible to disable transactions, either globally via `disableTransactions` config option, or locally when using `em.transactional()`. ```ts // only the outer transaction will be opened await orm.em.transactional(async em => { // but the inner calls to both em.transactional and em.begin will be no-op await em.transactional(...); }, { disableTransactions: true }); ``` Alternatively, you can disable transactions when creating new forks: ```ts const em = await orm.em.fork({ disableTransactions: true }); await em.transactional(...); // no-op await em.begin(...); // no-op await em.commit(...); // commit still calls `flush` ``` Closes #3747 Closes #3992
B4nan
added a commit
that referenced
this issue
Apr 23, 2023
Is it now possible to disable transactions, either globally via `disableTransactions` config option, or locally when using `em.transactional()`. ```ts // only the outer transaction will be opened await orm.em.transactional(async em => { // but the inner calls to both em.transactional and em.begin will be no-op await em.transactional(...); }, { disableTransactions: true }); ``` Alternatively, you can disable transactions when creating new forks: ```ts const em = await orm.em.fork({ disableTransactions: true }); await em.transactional(...); // no-op await em.begin(...); // no-op await em.commit(...); // commit still calls `flush` ``` Closes #3747 Closes #3992
jsprw
pushed a commit
to jsprw/mikro-orm-full-text-operators
that referenced
this issue
May 7, 2023
Is it now possible to disable transactions, either globally via `disableTransactions` config option, or locally when using `em.transactional()`. ```ts // only the outer transaction will be opened await orm.em.transactional(async em => { // but the inner calls to both em.transactional and em.begin will be no-op await em.transactional(...); }, { disableTransactions: true }); ``` Alternatively, you can disable transactions when creating new forks: ```ts const em = await orm.em.fork({ disableTransactions: true }); await em.transactional(...); // no-op await em.begin(...); // no-op await em.commit(...); // commit still calls `flush` ``` Closes mikro-orm#3747 Closes mikro-orm#3992
derevnjuk
added a commit
to derevnjuk/tsed
that referenced
this issue
Apr 23, 2024
derevnjuk
added a commit
to tsedio/tsed
that referenced
this issue
Apr 23, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This error makes total sense to me, something to do with using the in memory mongo server. However, it would be nice to be able to execute my code in spite of this so it works in the real environment
I think I'd be ok if I could set
transactions: false
on the global config and then just having transaction code being called be a no-op (transaction wise).The text was updated successfully, but these errors were encountered: