简体   繁体   English

在 ArangoDB 中的 collections 之间移动文档

[英]Move Documents between collections in ArangoDB

Is there a simple way to move documents between collections in ArangoDB?有没有一种简单的方法可以在 ArangoDB 的 collections 之间移动文档? I tried the cheap approach to just alter the _id , but as feared that's not supposed to be done or possible:我尝试了简单的方法来更改_id ,但担心这不应该或不可能:

FOR i IN collection_A
UPDATE { _key: i._key, _id: CONCAT('collection_B/',i._key) } IN collection_A

Are there useful ways how I can move my document from collection_A to collection_B with AQL?有没有有用的方法可以使用 AQL 将我的文档从collection_A移动到collection_B

You could try something like你可以尝试类似的东西

FOR i IN collection_A
    LET i_b = UNSET(i, "_id") // Remove the id that is not valid before insert
    INSERT i_b INTO collection_B
    REMOVE i IN collection_A

Just do an insert instead of an update For I in collection_A Insert into collection_B只需在 collection_A 中插入而不是更新 For I 插入到 collection_B

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM