1
votes

I want to do some remove action in arangodb transaction. This is my code:

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

And It's always raise some exception. Error Information is:

 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 !         ^

can somebody help me, Thanks!

1
Which version of arangodb do you use? - mpv89
Did the answer work for you? if yes, can you mark it 'accepted'? If not, whats missing? - dothebart

1 Answers

2
votes

Within a transaction-function db is not available, you have to require it with require("internal").db

Your code should look like this:

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