Topics   All   MacOS (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server   Client   Old   Deprecated   Guides   Examples   Videos
New in version: 11.3   11.4   11.5   12.0   12.1   12.2   12.3   12.4   12.5   13.0    Statistic    FMM    Blog  

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

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


MongoDB.HasCollection - MongoDB.InsertMany

Feedback: Report problem or ask question.


Start Chat