mongodbmongodb-atlasmongodb-stitch

Error while using context in Mongo-Atlas Stitch


I'm trying to create a stitch for a Mongo-Atlas cluster.

Here is the simple webhook function

exports = function(payload) {
   const mongodb = context.services.get("mongodb-atlas");
   const cyber = mongodb.db("cyber"); 

};

unfortunately running this gives me the error

TypeError: Cannot access member 'db' of undefined

trace: TypeError: Cannot access member 'db' of undefined at exports (function.js:4:18) at apply () at function_wrapper.js:3:10 at :12:1

Basically the first get call returns mongodb as undefined.

Anybody has run into this issue?


Solution

  • Ok this was silly.

    The context name for my cluster was not "mongodb-atlas" but rather "mongodb-atlas-production"