> error: TypeError: Cannot access member 'db' of undefined

exports = function(arg){
var collection = context.services.get(“Cluster0”).db(“Database”).collection(“alldata”);

return collection.find({});
};

error:
TypeError: Cannot access member ‘db’ of undefined

I keep getting this error. How can I fix this?

1 Like

I’ve also tried “mongo-atlas” too.

Check this link

Hi @tkdgy_dl ,

You should try mongodb-atlas instead.

If that doesn’t work can you go into function UI and copy paste the URL in the browser here

Thanks
Pavel

1 Like

@tkdgy_dl
I find the answer your problem.
In Atlas UI > Triggers, you have to press “Link” button after choice your Link Data Source(s).

The reason for the error in TypeError is not connected “Link Data Source(s)”, so occur ‘db’ of undefined.

1 Like

yoo!, Thank You bro.

Use the Cluster Selected in the Linked Data Sources instead of mongo-atlas