I have a question about transactions in arangodb, if I run below AQL query, will it be executed as one transaction or will it be separated into two transaction? My backend is php:
LET r1 = (FOR u IN Users UPDATE u WITH { status: "inactive" } IN Users)
LET r2 = (FOR b IN Blogs UPDATE b WITH { status: "inactive" } IN Blogs)
RETURN true
For now I am using transaction as arangodb documentation suggests (using javascript code), but if using AQL query is possible, I'd prefer to remove js code from my php code!
If it's possible, do you suggest this solution for commiting transactions or using js way is preferred?
(edited from original)
According to the docs:
In order to trigger a transaction you need to do so explicitly.
For example:
So, to answer the question, you need to use a client library to trigger a transaction as it will not happen automatically.
That being said, the main benefit of document/graph databases is the horizontal scaling, sharding, and cluster abilities. If you absolutely need to rely on transactions you might want to rethink why you are using a document based database. Eventual Consistency is typically good enough for a lot of use cases but in other cases you absolutely need ACID. A blog probably doesn't need ACID.