List Database in Mongo Atlas Triggers

Hi everyone,

I’m experimenting Mongo Atlas Triggers. I need my Triggers function to list databases on the cluster it is running against.

I cannot find the way to do this, I tried the “Nodejs mongodb driver” way, something like :

  const service = context.services.get("my-cluster");
  const dbAdmin = service.db("admin").admin();
  const listDb = await dbAdmin.listDatabases();
  console.log(listDb.databases);

But I get the following error :

{“message”:“‘admin’ is not a function”,“name”:“TypeError”}

I thought the call to : context.services.get("my-cluster") would gave me an object like the MongoClient object you get when we use the mongodb driver in a Node application but I’m certainly wrong here :slight_smile:

Do you know if this is possible ?

Just found this thread, so it seems it is not possible… :slight_smile:

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.