简体   繁体   中英

How to grant a task to execute a query?

I need to run a continous task inside my ArangoDb, the database itself has the security turned on. When I post a task to the API end point, the task is registered but then on the error log I get the following:

JavaScript exception in file 'undefined' at 3,75: ArangoError 11: forbidden

No surprise about it... But how can I actually log a user from the @arangodb module?

Just in case, here is the code of my task:

    function() {
      const db = require('@arangodb').db;
      db._useDatabase("foo"); 
      db._query("LET now = DATE_NOW() FOR u IN wait FILTER now - u.time >= 300000 REMOVE {_key: u._key} IN wait"); 
    }    

Have a look at this other question that states, the only other database Foxx can access is _system.

I'm assuming your example is not running in 'foo' and you're trying to jump over to a different database, which is forbidden.

If you want to have a single view of data in other database, you can publish REST endpoints in each database, with Foxx, and then from an external app call all of those REST endpoints, pulling in data from multiple databases.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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