Keep getting error: 'Missing `done()` argument' despite copying in solution

Tell us what’s happening:
I copied the solution into my file (janeFonda and all :slight_smile: but I am still getting the error: ‘Missing done() argument’.

Your code so far

const mongoose = require('mongoose');
mongoose.connect(process.env.MONGO_URI, {useUnifiedTopology: true, useNewUrlParser: true});

var Schema = mongoose.Schema;

var personSchema = new Schema({
    name:  String,
    age: Number,
    favoriteFoods: [String]

var Person = mongoose.model('Person', personSchema);

var createAndSavePerson = function(done) {
  var janeFonda = new Person({name: "Jane Fonda", age: 84, favoriteFoods: ["vodka", "air"]});, data) {
    if (err) return console.error(err);
    done(null, data)

**Your browser information:**

User Agent is: <code>Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.120 Safari/537.36</code>.

**Challenge:** MongoDB and Mongoose - Create and Save a Record of a Model

**Link to the challenge:**

If you scroll down into the myApp.js file, you have another declaration of Person and another declaration of createAndSavePerson. JavaScript will use the last declaration of each instead of the first (the ones you modified). Comment out the other ones and you will pass the tests.


Randell to the rescue again, thanks :slight_smile:

To be honest, I’m facing the same error and still don’t get it. I think all the instances of the person declaration are just fine.

It doesnt make sense to me how I was suppose to pass this given only the instruction:

" Create a document instance using the Person constructor you built before. Pass to the constructor an object having the fields name , age , and favoriteFoods . Their types must conform to the ones in the Person Schema. Then call the method on the returned document instance. Pass to it a callback using the Node convention. This is a common pattern, all the following CRUD methods take a callback function like this as the last argument."

It says nothing about requiring a variable named createAndSavePerson

frustrated that I spent time trying to figure out why copy+pasting the solution provided as a test wouldn’t work. I’ll revisit this curriculum at a later date, it feels incomplete