2 / 2
Apr 2024

I found an older post here: Getting error MongoDB Transactions with C# and the .NET Framework and yet I wonder why this is a thing? Transactions are meant to ensure multiple operations on different collections (and more) are atomic and can be reverted if any fails.

We do need them though for a few scenarios where embedding doesn’t work for us. But I can’t test it because our local Docker hosted instance is standalone (why bother with a cluster for local). The driver doesn’t allow it though because “System.NotSupportedException: Standalone servers do not support transactions.”

Why that? And how am I now supposed to test this? If clusters behave different than local deployments this is horrific for development. My code fails locally while it might work on production. No guarantee and non-deterministic.

If the driver doesn’t support it, why not just ignore it? Can’t you just kind of simulate that behavior so the logic works the same but the server decides how to handle things?

Btw: Your AI helper in the docs even tells me that Standalone supports transactions. So is it a fault of the driver or is your AI spreading misinformation?

Thanks for the help!