[英]ArangoDB lastinsert-Value is NULL
My Query: 我的查询:
I would insert 2 Datasets on 2 Collections with lastInsert Key. 我将使用lastInsert键在2个集合上插入2个数据集。
LET i = (
INSERT {"lvl": @Lvl, "kapitel_key":@Kkey, "plan_key": @Pkey, "xcontent_key": @Xckey, "user_key": @User_key, "templatefile": @Tf }
IN xtemplate
LET inserted = NEW
RETURN MERGE(inserted)
)
INSERT {"type": "text", "text": "Write here...", "xtemplate_key": i._key, "user_key": @User_key} IN xinhalt
Result: 结果:
{
"type": "text",
"text": "Write here...",
"xtemplate_key": null,
"user_key": "2345632"
}
Why is i._key
NULL? 为什么
i._key
NULL?
Winke winke 温克·温克
The result i
of your subquery is from type array not document. 您的子查询的结果
i
来自数组类型而不是文档。 Every query result in AQL is from type array (see docs ). AQL中的每个查询结果都来自数组类型(请参阅docs )。
You have to write i[0]._key
instead of i._key
within your second INSERT. 您必须在第二个INSERT中写入
i[0]._key
而不是i._key
。
LET i = (
INSERT {"lvl": @Lvl, "kapitel_key":@Kkey, "plan_key": @Pkey, "xcontent_key": @Xckey, "user_key": @User_key, "templatefile": @Tf }
IN xtemplate
LET inserted = NEW
RETURN MERGE(inserted)
)
INSERT {"type": "text", "text": "Write here...", "xtemplate_key": i[0]._key, "user_key": @User_key} IN xinhalt
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.