I can't seem to find anything in the documentation around the usage of transactions with Classes API.
There is a Db#begin() method that starts a new transaction. So given the code below:
const db = server.use('MyDb');
const transaction = db.begin();
const Product = await transaction.db.class.get('Product');
//Transaction already gets committed to the database here before commit is executed
await Product.create({name: 'Milk', brand: 'Clover'})
transaction.commit()
I would have thought the transaction would only be committed on transaction.commit() but it gets is committed immediately. I know about the db.let() syntax but something like above would be a lot easier to work with.
I don't see the value of the Class#create(record) method if you can't use it with a transaction. Which makes me believe I'm missing something but I've been racking my brain on this for the last day.