title: Still getting "Schema is not a constructor", despite properly importing and exporting my Schema
body: <p>Here is my code. I have a review schema in a separate file called "review.js".</p>
  
  <pre><code>const express = require('express');
  const mongoose = require('mongoose');
  const User = require('../model/user');
  require('mongoose-currency').loadType(mongoose);
  const Currency = mongoose.Types.Currency;
  const Schema = mongoose.Schema;
  
  let reviewSchema = new Schema();
  
  reviewSchema.add({
  
  
      rating: {
          type: Number,
          min: 1,
          max: 5,
          defualt: 0
      },
  
  
      howEasyToMake: {
          type: Number,
          required: true,
          min: 1,
          max: 5
      },
  
      howGoodTaste: {
          type: Number,
          required: true,
          min: 1,
          max: 5,
      },
  
      wouldMakeAgain: {
          type: Number,
          required: true,
          min: 1,
          max: 5,
      },
  
  
      comment: {
          type: String,
          default: ""
      },
  
  
      postedBy: {
          type: String,
          required: true,
          index: true
      },
  
      reviewOf: {
          type: String,
          required: true,
          index: true
      },
  
      postersCreationDate: {
          type: Number,
          required: true
      },
  
      chefsCreationDate: {
          type: Number,
          required: true
      },
  
      chefsId: {
          type: String,
          required: true
      }
  
  
  });
  
  module.exports.reviewSchema = reviewSchema;
  </code></pre>
  
  <p>I have another file called recipe.js, where I import reviewSchema and use it as an embedded schema for my Recipe model schema.</p>
  
  <pre><code>const express = require('express');
  const mongoose = require('mongoose');
  const User = require('../model/user');
  require('mongoose-currency').loadType(mongoose);
  const Currency = mongoose.Types.Currency;
  const Schema = mongoose.Schema;
  const reviewSchema = require('../model/review').reviewSchema;
  
  
  
  let recipeSchema = new Schema({
  
    name: {
      type: String,
      required: true
    },
  
    description: {
      type: String,
    },
  
    steps: {
      type: String,
      required: true,
    },
  
    ingredients: {
      type: Array,
      default: ['1', '2', '3', '4']
    },
  
    category: {
      type: String,
      required: true,
      index: true
    },
  
    postedBy: {
      type: String,
      required: true,
    },
  
  
    reviewsOfRecipe: [reviewSchema],
  
    numberOfRatings: {
      type: Number,
      default: 0
    },
  
    totalAddedRatings: {
        type: Number,
        default: 0
    },
  
    reviewAverage: {
        type: Number,
        default: undefined
    },
  
  
  
    postersCreationDate: {
      type: Number,
      index: true
    },
  
    likedBy: {
        type: Array
  
    },
  
    reviewedBy: {
        type: Array
    }
  
  
  });
  
  
  
  recipeSchema.methods.updateReviewAverage = function(){
  
      let recipe = this;
  
      this.reviewAverage = this.totalAddedRatings / this.numberOfRatings;
  
  };
  
  
  let Recipe = mongoose.model('Recipe', recipeSchema);
  
  module.exports = Recipe;
  </code></pre>
  
  <p>I have another file called <code>recipeRouter.js</code> where I use <code>reviewSchema</code> to construct a review to then later insert it into the embedded <code>reviewsOfRecipes</code> array in my <code>Recipe</code> document. In my recipRouter.js file, every time my code tries to do this....</p>
  
  <p>Recipe.findOne({name: req.params.name}).then((recipe) => {</p>
  
  <pre><code>   let review_ = new reviewSchema({
              comment: req.body.comment
              rating: req.body.score
          });
  
     recipe.reviewsOfRecipe.push(review_);
  </code></pre>
  
  <p>})</p>
  
  <p>...I get this error.</p>
  
  <pre><code> TypeError: reviewSchema is not a constructor
  </code></pre>
  
  <p>Previously, when I ran into this problem, I had the reviewSchema in the same file as my Recipe model schema. Since then, I split the two into each having their own file. And I made sure to properly export <code>module.exports.reviewSchema = reviewSchema;</code> in my <code>review.js</code> file, and made sure to have <code>const reviewSchema = require('../model/review').reviewSchema;</code> in both my <code>recipe.js</code> and <code>recipeRouter.js</code> files. Yet still this issue still comes up/ I would greatly appreciate it if someone could point out what may be the issue.</p>