该问题通常是由于使用了错误的参数调用该方法导致的。
例如,以下代码调用了collections()方法,但是没有指定正确的数据库名称:
const db = new Database();
const collections = await db.collections();
此时,将会抛出类似下面的错误:
ArangoError: database name must be a string
解决这个问题所需要做的,就是正确地指定数据库名称
const db = new Database({ url: 'http://localhost:8529' });
const collections = await db.database('example-db').collections();
这里指定了正确的数据库名称,并且使用了正确的方法调用方式。如果有其他参数出现错误,请确保按照文档中的说明来正确使用它们。