Mongodb create model

Tell us what’s happening:
Describe your issue in detail here.
Creating an instance from a mongoose schema should succeed
my code:

const Schema = mongoose.Schema;
const personSchema = new Schema({
  name: { type: String, required: true },
  age: Number,
  favoriteFoods:[{ String
                 
}]});
const Person = mongoose.model("Person", personSchema);

Your project link(s)

solution: Glitch :・゚✧

Your browser information:

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

Challenge: Create a Model

Link to the challenge:

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 it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (’).

What about the instructions are confusing to you? Where did you get stuck?

const Schema = mongoose.Schema;
const personSchema = new Schema({
  name: { type: String, required: true },
  age: Number,
  favoriteFoods: [String]
});
const Person = mongoose.model("Person", personSchema);

iv typed in it says
Creating an instance from a mongoose schema should succeed

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 it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (’).

That’s literally what you said in the first post. That gives zero additional information.

What debugging have you tried?

This is deep enough in the curriculum that you really need some debugging skills to be successful. Just handing wrong code and an error message to someone and expecting them to debug for you won’t work very well as you progress. We need more data to help more effectively and you need to practice debugging and technical communication skills to be more effective as a developer.

Do you get any errors when you run the code manually? Can you put in a console log to see what output you are getting?

I’ve debugged it gives error plz could u provide me the solution

I’ve tried everything plz Cul u provide me the solution

We don’t write answers for users.

It’s hard to debug “I tried everything”. What is “everything”?

You are not using the correct starter boilerplate.

You have problem probably in the first line of your code here.

Check the documentation for Mongoose Schemas (mongoosejs.com) and compare to yours.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.