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

DisableTransactions in MongoDB, debugging Cosmos DB for MongoDB #215

Closed
elier opened this issue Jul 25, 2023 · 5 comments
Closed

DisableTransactions in MongoDB, debugging Cosmos DB for MongoDB #215

elier opened this issue Jul 25, 2023 · 5 comments

Comments

@elier
Copy link

elier commented Jul 25, 2023

Describe the bug

Not sure if the DisableTransactions option is being taken into consideration when passed, in the code it looks like hardcode to false, and never used:

disableTransactions = false

My code:

MongoDataProvider(client.db((process.env as any).MONGODB_DATABASE_NAME), client, { disableTransactions: true });

I wanted to disable transactions because I'm getting the following error:

Error=2, Details='Response status code does not indicate success: BadRequest (400); Substatus: 1101; ActivityId: 4a5f881b-e63d-4756-981e-23b60d6428e4; Reason: (Response status code does not indicate success: BadRequest (400); Substatus: 1101; ActivityId: 4a5f881b-e63d-4756-981e-23b60d6428e4; Reason: (Response status code does not indicate success: BadRequest (400); Substatus: 1101; ActivityId: 4a5f881b-e63d-4756-981e-23b60d6428e4; Reason: (Message: {"Errors":["Transaction is not active"]}
@noam-honig
Copy link
Collaborator

Thanks.
I've fixed it in version 0.22.1 (https://github.com/remult/remult/releases/tag/v0.22.1)

Can you check it and let me know that it's ok?

@elier
Copy link
Author

elier commented Jul 25, 2023

Yes! { disableTransactions: true } works now!

I still got the following error from Cosmos DB if I set disableTransaction to false.

Reason: (Message: {"Errors":["Transaction is not active"]}

According to Cosmos DB for MongoDB documentation:
Multi-document transactions are supported within an unsharded collection in API version 4.0. Multi-document transactions are not supported across collections or in sharded collections in 4.0.
https://learn.microsoft.com/en-us/azure/cosmos-db/mongodb/use-multi-document-transactions

I'm using Cosmos DB 4.2 API, and unsharded collection. However, two simple reading operations from a static backendMethod cause Cosmos DB to trigger the error.

I guess, I won't be able to use transactions, cause any backendMethod just reading more than one collection will fail.

@elier elier closed this as completed Jul 25, 2023
@noam-honig
Copy link
Collaborator

noam-honig commented Jul 25, 2023 via email

@elier
Copy link
Author

elier commented Jul 25, 2023

No, if I set disableTransaction to true, all works fine.

@noam-honig
Copy link
Collaborator

noam-honig commented Jul 25, 2023 via email

noam-honig added a commit that referenced this issue Jul 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants