Arangodb删除动作错误

时间:2016-09-21 10:48:37

标签: arangodb

我想在arangodb事务中执行一些删除操作。这是我的代码:

  db._executeTransaction
  ({ 
    collections: 
    {
            write: [ "demo" ]
        },
    action: function(){db.demo.removeByExample( {"Hello":"World"} );}
    }); 

它总是引发一些例外。错误信息是:

 ERROR JavaScript exception in file 'f:/work_lc/aran
 odb/js/server/modules/org/arangodb/arango-database.j
 651: nested transactions detected]
 ERROR !  return TRANSACTION(data);
 ERROR !         ^

有人可以帮助我,谢谢!

1 个答案:

答案 0 :(得分:2)

在交易功能中db不可用,您必须使用require("internal").db

您的代码应如下所示:

  db._executeTransaction
  ({ 
    collections: 
    {
            write: [ "demo" ]
        },
    action: function(){require("internal").db.demo.removeByExample( {"Hello":"World"} );}
    }); 
相关问题