Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

MongoDB.InTransaction

Check whether a multi-document transaction is in progress for this session.

Component Version macOS Windows Linux Server iOS SDK
MongoDB 12.5 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "MongoDB.InTransaction"; MongoDBRef )   More

Parameters

Parameter Description Example
MongoDBRef The reference number for the mongo connection. $MongoDB

Result

Returns 1, 0 or error.

Description

Check whether a multi-document transaction is in progress for this session.
Returns 1 if a transaction was started and has not been committed or aborted, otherwise 0.

Examples

Abort transaction if we still have one:

If [ MBS( "MongoDB.InTransaction"; $Mongo ) ]
    Set Variable [ $r ; Value: MBS( "MongoDB.AbortTransaction"; $mongo ) ]
End If

See also

Release notes

Blog Entries

This function checks for a license.

Created 23th September 2022, last changed 24th September 2022


MongoDB.HasCollection - MongoDB.InsertMany

💬 Ask a question or report a problem