0
votes

does anyone know if arangodb has any sort of data dictionary available ? In essence we’re responsible for reporting and it would be helpful to be able to run a query that would enable us to list of collection and attributes so we can see has been been added/removed/updated ?

Basically an equivalent of all_tab_columns in oracle would be helpful .

Thanks

1
Remember, ArangoDB is a NoSQL database, so the way it handles schemas is different to an RDBMS. Look at arangodb.com/docs/stable/aql/functions-document.html to see how you can query ATTRIBUTES of documents (analogous to RDBMS columns) - David Thomas

1 Answers

0
votes

You could use arangosh command (more) and list all collections in a database using db._collections(). Then you can run a query that goes through every document in a collection and gets its ATTRIBUTES (source).

Example bash script:

#!/bin/bash

read -p "Database: " DATABASE
read -p "Username: " USERNAME
read -s -p "Password: " PASSWORD

echo

ARANGOSH_SCRIPT=$(cat <<-END
  const getAttributes = (collection) => db._query(\`
    FOR rec IN \${collection}
      FOR attr IN ATTRIBUTES(rec)
        RETURN DISTINCT attr
  \`).toArray();
  db._collections().forEach((collection) => {
    if (collection.properties().isSystem) {
      // ignore system collections
      return;
    }
    const collectionName = collection.name();
    print(\`\${collectionName}: \${JSON.stringify(getAttributes(collectionName))}\`);
  });
END
)

arangosh --server.database "$DATABASE" \
 --server.username "$USERNAME" \
 --server.password "$PASSWORD" \
 --javascript.execute-string "$ARANGOSH_SCRIPT"