Home > OS >  ReferenceError: mangoose is not defined
ReferenceError: mangoose is not defined

Time:04-21

Node is throwing the 'ReferenceError: mangoose is not defined' at me.

It states that the error is in this line:

const dogSchema = new mangoose.Schema({

I have instelled mongoose by npm

$ npm i mongoose

And here's the code

const mongoose = require("mongoose");

mongoose.connect("mongodb://localhose:27017/fruitsDB")

const fruitSchema = new mangoose.Schema({

Can anyone recognise what the problem is? I've required mongoose in the .js file and installed it via npm. Thanks a lot!

CodePudding user response:

You have a typo in line 3 of your code. It should be mongoose, not mangoose.

CodePudding user response:

const mongoose = require("mongoose");

mongoose.connect("mongodb://localhose:27017/fruitsDB")

const fruitSchema = new mongoose.Schema({

"mongoose" was spelled "mangoose" on line 3

  • Related