在 orientdb 中批量插入

Bulk insert in orientdb

我有两个不同的 classes:RecordLocationRecord 有一个 location 属性 link 到 Location class。

我想在一个语句中创建一条带有新位置的记录,就像这样:

insert into record content {location:{name:"EDR"}}

我希望这会创建名称为 EDR 的新位置,并且 link 它到记录的 属性 位置,但它抛出了这个异常。

com.orientechnologies.orient.core.exception.OValidationException: The field 'record.location' has been declared as LINK but the value is not a record or a record-id

有人能帮帮我吗?

您可以使用

insert into record set location = (insert into location(name) values ("EDR"))

你也可以试试这个:

insert into Record set location = (insert into Location content {name:'EDR'})

希望对您有所帮助

似乎内部对象被视为 MAP 而不是文档。然而,尝试强制内部对象是文档而不是 MAP(在 OrientDB 中你可以同时拥有两者):

insert into record content {"@type":"d", "location":{"@type":"d", "name":"EDR"}}