Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/hadoop/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Orientdb 是否可以在orientjs中使用带有th类API的事务?_Orientdb_Orientjs - Fatal编程技术网

Orientdb 是否可以在orientjs中使用带有th类API的事务?

Orientdb 是否可以在orientjs中使用带有th类API的事务?,orientdb,orientjs,Orientdb,Orientjs,我在文档中似乎找不到任何关于使用API类的事务的信息 有一个启动新事务的Db#begin()方法。因此,鉴于以下代码: 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 com

我在文档中似乎找不到任何关于使用API类的事务的信息

有一个启动新事务的
Db#begin()
方法。因此,鉴于以下代码:

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()
我原以为只有在
transaction.commit()
上提交事务,但它会立即提交。我知道
db.let()
语法,但是上面的类似内容更容易使用


如果不能将
类#create(record)
方法用于事务,我看不到它的价值。这让我相信我错过了什么,但我已经绞尽脑汁在这最后一天了

您好,Marthinus Engelbrecht,您使用哪个版本的Orientdb?我在2.2中尝试过这个。但是在3中的文档中没有看到任何关于它的内容