Custom database connect to MongoDB Cloud Atlas using auth0

Unable to connect to MongoDB CLoud atlas on the custom database. Need to have documentation on it
I am getting 500 error on console. Please help me with this asap. Thank you

function getByEmail(email, callback) {
  const MongoClient = require('mongodb').MongoClient;
  const uri = `mongodb://${	
  const client = new MongoClient(uri, { useNewUrlParser: true });
  client.connect(uri, function (db) {
    const collection = client.db("database").collection("users");

    collection.findOne({ email: email }, function (err, user) {
      if (err) return callback(err);

      return callback(null, {
        user_id: user._id.toString(),

Hey there!

Sorry for such huge delay in response! We’re doing our best in providing you with best developer support experience out there, but sometimes our bandwidth is not enough comparing to the number of incoming questions.

Wanted to reach out to know if you still require further assistance?