Create and Save a Record of a Model Error Issue

Tell us what’s happening:
My createAndSavePerson function won’t work. I keep getting
(node:18723) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)

11:24 PM

(node:18723) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Your code so far
var Person = mongoose.model(‘Person’, personSchema)
var Person = mongoose.model(‘Person’, personSchema)
var createAndSavePerson = function(done) {
var johnRon = new Person({name: “John Ron”, age: 84, favoriteFoods: [‘Pizza’, ‘Burger’, ‘Ice Cream’]});, data){
if (err){
return done(err);
done(null, data);


Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36.

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

Link to the challenge:

Can you please post a link to your Glitch project, so we can take closer look at all the code?

Thank you.

I believe you have to separate problems.

First, you need to delete or comment out the following line.


Next, you need to make sure to assign your Mongo Atlas URI to the MONGO_URI variable in your .env file. Make sure to actually put the password in the URI and not <password>, as that will do nothing. It is recommended to surround the entire URI with single quotes.

Thank you. I moved everything to an .env and put in the correct info. It works now.