[Solved] Learnyounode 5 (Insert) no console, no verification, help?

[Solved] Learnyounode 5 (Insert) no console, no verification, help?


Solved: READ THE DIRECTIONS!! Ugh. it’s like a high school multiple choice test…all my errors were either typos or not returning what it asked for.

Updated: I had a typo and an extra ‘)’ both fixed. Now when I do node insert.js, I get output that looks like it was successful. I’m using JSON.stringify(data) in the return but I’m getting this error when I try to ‘verify’.

Any suggestions? I’ve checked other solutions and there are no glaring differences. Thanks.

var port = 27017;
var collection = 'docs';
var dbname = 'learnyoumongo';
var firstName = process.argv[2];
var lastName = process.argv[3];
var url = 'mongodb://localhost:27017/'+ dbname;
var mongo = require('mongodb').MongoClient;


mongo.connect(url, function(err, db) {
  // db gives access to the database
  console.log('Connected to db' + dbname);

  if(err) throw err;

    first: firstName,
    last: lastName
  }, function(err, data) {
    // handle error
    if (err) throw err;
    // other operations