什么样的对象db._collections()返回ArangoDB?

irlmq6kh  于 2022-12-09  发布在  Go
关注(0)|答案(1)|浏览(147)

在Foxx环境中,我使用数据库方法访问arango db._collections()中的所有集合。返回值是一个数组。但在数组中,每个“对象”不是字符串,不是数组,也不是对象。它们的类型是什么?
返回示例:

//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)] 
]
mw3dktmi

mw3dktmi1#

db._collections()返回一个ArangoCollection对象数组。你可以通过运行标准的JavaScript检查方法,比如Object.keys(...),来找出这种类型的对象。

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

相关问题