Help with Model create

Hello Dev’s
I’m try to solve the “MongoDB and Mongoose - Create a Model” exercise and don’t have success.

I read the questions about this exercise, but the message that i receive is: “not found”
Anybody can help me, to identify what is wrong with the code above?

Thanks in advance.

My Code:


var express = require('express');
var app = express();
var mongoose = require('mongoose');

app.get("/", function(req, res, next) 
{ 
  if(process.env.MONGODB_URI)
  {     
    mongoose.connect(process.env.MONGODB_URI);
    // connect to the server
    var db = mongoose.connection; 
    // check connection errors
    db.on('error', console.error.bind(console, 'connection error:'));
    // Once established connection
    db.once('open', function(done)
    {
         var Schema = mongoose.Schema;
         var PersonSchema = new Schema(
         {
           name: 
           {
            type: String,
            required: true
           },             
           age:   Number,
           favoriteFoods :[ String]     
         });
         var PersonModel = mongoose.model('Person', PersonSchema);
         PersonModel.create({ name: 'Teste', age: 18, favoriteFoods: ['Pao','Hamburger'] }, function (err, small) 
         {
            if (err) return res.end(err);  

            done();
         });
    });
  }  
});

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make easier to read.

Note: Backticks are not single quotes.

See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (</>) will also add backticks around text.

markdown_Forums

Thank’s ArielLeslie.
In future, will write in a better form.