skip to Main Content

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!

2

Answers


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

    Login or Signup to reply.
  2. const mongoose = require("mongoose");
    
    mongoose.connect("mongodb://localhose:27017/fruitsDB")
    
    const fruitSchema = new mongoose.Schema({
    

    "mongoose" was spelled "mangoose" on line 3

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search