gpt4 book ai didi

javascript - 使用 OrientJS 创建带有链接列表的记录时出错

转载 作者:太空宇宙 更新时间:2023-11-04 02:09:45 24 4
gpt4 key购买 nike

我正在尝试使用 NodeJS 服务器上的 OrientJS 框架将对象保存到数据库中。该对象包含一些 native 参数以及应指向另一个类的记录的 RID 数组。看这个:

var myObj = {
name: 'myNewObjectName',
'@class': 'OuterClass',
parameter: ['#225:13']
}

在 OrientDB 类中,“参数”字段被定义为 LINKLIST。但是,当我尝试为此对象创建新记录时:

db.record.create(myObj).then(function(record){
console.log(record);
});

我得到了异常(exception):

Unhandled rejection OrientDB.RequestError: For input string: "#225" at child.Operation.parseError (C:\Users\...\node_modules\orientjs\lib\transport\binary\protocol33\operation.js:864:13)
at child.Operation.consume (C:\Users\...\node_modules\orientjs\lib\transport\binary\protocol33\operation.js:455:35)
at Connection.process (C:\Users\...\node_modules\orientjs\lib\transport\binary\connection.js:399:17)
at Connection.handleSocketData (C:\Users\...\node_modules\orientjs\lib\transport\binary\connection.js:290:20)
at emitOne (events.js:96:13)
at Socket.emit (events.js:188:7)
at readableAddChunk (_stream_readable.js:176:18)
at Socket.Readable.push (_stream_readable.js:134:10)
at TCP.onread (net.js:548:20)

那么不知何故,集群后面的 ID 没有被传递?我做错了什么,还是这是一个错误?我还能做什么?

非常感谢您的帮助!

最佳答案

您应该使用 RID 对象来插入链接。试试这个。

const RID = require('orientjs').RID;
.....
var myObj = {
name: 'myNewObjectName',
'@class': 'OuterClass',
parameter: [new RID('#225:13')]
}

关于javascript - 使用 OrientJS 创建带有链接列表的记录时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42812195/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com