The line of process.env.MONGO_URL = uri; passing connection string to the tested app, in the below connection code, but the app using this connection url get connection refused.
const connect = async () => {
var mongodb = require('mongo-mock');
var uri = 'mongodb://localhost:27017/myproject';
process.env.MONGO_URL = uri;
process.env.MDB_NAME = 'PricerDB_EMEA';
var MongoClient = mongodb.MongoClient;
MongoClient.connect(url, {}, function (err, client) {
db = client.db();
var collection = db.collection('adjustmentsDetails');
collection.insertOne({ "startOn": new Date("2020-07-10 15:00:00.000") })
})
}
The line of process.env.MONGO_URL = uri; passing connection string to the tested app, in the below connection code, but the app using this connection url get connection refused.
const connect = async () => { var mongodb = require('mongo-mock'); var uri = 'mongodb://localhost:27017/myproject'; process.env.MONGO_URL = uri; process.env.MDB_NAME = 'PricerDB_EMEA'; var MongoClient = mongodb.MongoClient; MongoClient.connect(url, {}, function (err, client) { db = client.db(); var collection = db.collection('adjustmentsDetails'); collection.insertOne({ "startOn": new Date("2020-07-10 15:00:00.000") }) }) }