Closed
Description
Hi everyone,
I'm observing an odd behavior with the following script (using arangojs 7.7.0):
const { Database, aql } = require("arangojs");
const db = new Database("http://db:8529");
db.useBasicAuth("myusername", "mypassword");
db.useDatabase("MyDatabase");
const col = db.collection("MyCollection");
db.query(aql`FOR doc in ${col} RETURN doc`).then(async (cursor) => { console.log("Done"); }); // it works up to here
db.listUsers().then((usersData) => {
console.log("Users data", usersData); // this does not print an array of ArangoUser as I'd expect, but an object of type IncomingMessage ...
});
const usersData = await db.listUsers();
console.log("Users data", usersData); // same as above ...
const userDBs = await db.listUserDatabases(); // this works OK, it prints the names of available databasess, as expected (array of strings ...)
The value of variables usersData
in both examples above is the following:
Users data <ref *2> IncomingMessage {
_readableState: ReadableState {
objectMode: false,
highWaterMark: 16384,
buffer: BufferList { head: null, tail: null, length: 0 },
length: 0,
pipes: [],
flowing: true,
ended: true,
endEmitted: true,
reading: false,
constructed: true,
sync: true,
needReadable: false,
emittedReadable: false,
readableListening: false,
resumeScheduled: false,
errorEmitted: false,
emitClose: true,
autoDestroy: true,
destroyed: true,
errored: null,
closed: true,
closeEmitted: true,
defaultEncoding: 'utf8',
awaitDrainWriters: null,
multiAwaitDrain: false,
readingMore: true,
dataEmitted: true,
decoder: null,
encoding: null,
[Symbol(kPaused)]: false
},
...
Following this documentation I'd expect an array of ArangoUser
objects, instead.
Am I doing something wrong? Note that if I call another method (e.g. listUserDatabases()
) I get the expected result (an array of strings).