I'm having trouble determining the correct placement for { useNewUrlParser: true}. Should I adjust how I connect to Mongo?
var express = require('express');
var router = express.Router();
var assert = require('assert');
var url = 'mongodb://urlformyconnection;
const MongoClient = require('mongodb').MongoClient;
const objectId = require('mongodb').ObjectID;
const client = new MongoClient(url);
const dbName ='transactions';
.....
router.post('/insert', function (req, res, next){
var item = {
firstN: req.body.firstN,
lastN: req.body.lastN,
ccNum: req.body.ccNum,
cvc: req.body.cvc,
zip: req.body.zip,
amount: num
};
MongoClient.connect(url, function(err, client)
{assert.equal(null, err);
const db = client.db(dbName);
db.collection('transac-info').insertOne(item, function (err, result) {
assert.equal(null, err);
console.log('Transaction Inserted');
client.close();
});
});
res.redirect('/');
});