javascriptarangodbfoxx

What kind of object db._collections() return ArangoDB?


In Foxx context, I am using the database methods to access all collections in arango db._collections(). The return value is an array. But within the array, each "object" is not a string, not an array, not an object.What is their type?

Example return:

//This is 1 array. Correct
[ 
 //Each should be an array but they are not.
  [ArangoCollection 41, "_analyzers" (type document, status loaded)], 
  [ArangoCollection 38, "_appbundles" (type document, status loaded)], 
  [ArangoCollection 31, "_apps" (type document, status loaded)], 
  [ArangoCollection 14, "_aqlfunctions" (type document, status loaded)], 
  [ArangoCollection 4, "_graphs" (type document, status loaded)], 
  [ArangoCollection 20, "_jobs" (type document, status loaded)], 
  [ArangoCollection 17, "_queues" (type document, status loaded)], 
  [ArangoCollection 67, "_statistics" (type document, status loaded)], 
  [ArangoCollection 74, "_statistics15" (type document, status loaded)], 
  [ArangoCollection 60, "_statisticsRaw" (type document, status loaded)], 
  [ArangoCollection 7, "_users" (type document, status loaded)], 
  [ArangoCollection 95, "animals" (type document, status loaded)], 
  [ArangoCollection 89, "demo" (type document, status loaded)], 
  [ArangoCollection 73882, "example" (type document, status loaded)] 
]

Solution

  • db._collections() returns an array of ArangoCollection objects. You can find out about this type of object by running standard JavaScript inspection methods such as Object.keys(...) on it, e.g.

    obj = db._collections()[0]; 
    Object.keys(obj).forEach(function(key) { 
      require("console").log(key + ' (' + typeof obj[key] + ')'); 
    });