Create And Save A Person (mongo/mongoose)

Tell us what’s happening:
Im getting test timed out, ive went though the hints and i was very close i just hadnt put it all inside the const createAndSavePerson function am slightly confused where that actually came from and why. however i had a feeling i needed a function due to the node done convention being undefined.

im not sure why this is timing out

edit: when i comment out the line which is confusing me (create and save person) it doesnt pass obviously but it doesnt time out either.

edit2: when i change the const to var it doesnt pass but doesnt time out either, when i change it to let it still times out.

edit3: glitch link: https://glitch.com/edit/#!/ginger-sousaphone?path=myApp.js:15:0

Your code so far

const personSchema =  new Schema({
  name:String,
  age:Number,
  favoriteFoods:[String]
})

const Person  = mongoose.model('Person',personSchema)


const createAndSavePerson = (done) => {

const norman = new Person({ name:"norman", 
                           age:26,
                           favoriteFoods:['pizza','chips']
})
    
    norman.save((err,data) => {
      if (err) {
        done(err)
      }
      done(null,data)
    })
}


Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:71.0) Gecko/20100101 Firefox/71.0.

Challenge: undefined

Link to the challenge:
https://www.freecodecamp.org/learn/apis-and-microservices/basic-node-and-express/implement-a-root-level-request-logger-middleware

JS closes down with ; not : 
also where are your closing tags the ; ?

ive only used : in key pair values like normal objects in js, im not quite sure what you mean?

its my understanding in js the ; is a style choice alough ive been told crockford does give good arguments for using it always its not actually ever needed, i centainly havnt used it though any of the vanilla/react/d3 work ive done so far.

i however did go back and add them and still have the extact same problem any insights into the issue with my code?

const personSchema =  new Schema({
  name:String,
  age:Number,
  favoriteFoods:[String]
});

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


var createAndSavePerson = (done) => {

const norman = new Person({ name:"norman", 
                           age:26,
                           favoriteFoods:['pizza','chips']
});
    
    norman.save((err,data) => {
      if (err) {
        done(err);
      }
      done(null,data)
    });

};

@aoc386 You seem to be asking for help with the Create and Save a Record of a Model challenge, but clicked the Ask for Help button from the Implement a Root-Level Request Logger Middleware challenge. Which challenge are you failing?

Also, you have two different createAndSavePerson functions in your myApp.js. Only the last version will get executed by JavaScript when called.

oh sorry i clicked the ask for help button from an old page just to link to the forum i didnt think it made a difference if changed the title.

im currently failing on the create and save a person part of mongo/mongoose from looking around i found a command console.log(mongoose.connection.readyState) which gives you a number to indercate where mongoose is in the connection chain and it currently gives me a 2 which means its connecting not connected or failed to connect ive tried refreshing the page and putting the log in mutiple places and it never gets past connecting so thats my issue now, i was going to update it in the morning as its 2am here and figured i was prob needed a break.

ive got all ips whitelisted as ive found from glitch you must have all ips and have tried with 2 seprate username/password combos but no luck so far.

edit: oh ye weirdly i dont see the second createAndSavePerson function lol im not sure whats going on there i even opened the link above for a second check.

There definitely are two versions of the createAndSavePerson function in the myApp.js file of the linked Glitch project.

im just gonna start it from stratch and see if i can get past the connection issue