2017-05-02 6 views
0

私のクエリ:ArangoDB lastinsert - 値はNULLです

私は2つのデータセットを2つのコレクションにlastInsert 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._key, "user_key": @User_key} IN xinhalt 

結果:

{ 
    "type": "text", 
    "text": "Write here...", 
    "xtemplate_key": null, 
    "user_key": "2345632" 
} 

なぜi._key NULLがありますか?

はWinkeは型の配列は、文書化していないから、あなたのサブクエリの

答えて

0

結果iがあるwinke。 AQLのすべてのクエリ結果は、型配列からです(docs参照)。

i._keyの代わりにi[0]._keyを2番目のINSERTに書き込む必要があります。

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 
+0

Thx作業用ジェット! – Moo