Trying to connect Mongodb to Auth0 custom database service

I am connecting my Auth0 application to my MongoDB database through the Auth0 custom database but when i try to create a user using the following code:

function create(user, callback) {
const bcrypt = require(‘bcrypt’);
const MongoClient = require(‘mongodb@3.1.4’).MongoClient;
const client = new MongoClient(‘mongodb+srv://EmileSumar:’+configuration.MONGODB_PASSWORD+’@sswebsitecluster.dyhsxud.mongodb.net/?retryWrites=true&w=majority’);

client.connect(function (err) {
if (err) return callback(err);

const db = client.db('SSWebsiteDb');
const users = db.collection('users');

users.findOne({ email: user.email }, function (err, withSameMail) {
  if (err || withSameMail) {
    client.close();
    return callback(err || new Error('the user already exists'));
  }

  bcrypt.hash(user.password, 10, function (err, hash) {
    if (err) {
      client.close();
      return callback(err);
    }

    user.password = hash;
    users.insert(user, function (err, inserted) {
      client.close();

      if (err) return callback(err);
      callback(null);
    });
  });
});

});
}

I get the following error:

[MongoNetworkError] failed to connect to server [localhost:27017] on first connect [Error: connect ECONNREFUSED 127.0.0.1:27017\n at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1144:16)\n at TCPConnectWrap.callbackTrampoline (internal/async_hooks.js:126:14) {\n name: ‘MongoNetworkError’,\n errorLabels: [Array],\n [Symbol(mongoErrorContextSymbol)]: {}\n}]

Does anyone know how to fix this?