Atomic transactions in cloud code


I have seen PR request that transaction are now supported in REST api and some conversation about bugs in internal SDK, but have not found any examples or documentation.

So, my question in the subject line: how can I use transactions in the cloud code (MongoDB 4.2) ?

Thanks for any help!!!

You can get some inspiration from the test cases:

@davimacedo Thanks for reply, I have seen this code as part of PR, but what I see is only post requests with transaction: true, my question how can I do it cloud code ? (Doing posts from cloud code doesn’t seems reasonable for me :face_with_raised_eyebrow:)

The transaction option is not implemented in JS SDK yet. You can use the ParseServerRESTController to avoid the http request from Cloud Code:

ParseServerRESTController relays the “REST” request directly to Parse Server internals and that’s the class that the JS SDK uses within cloud code.