I'm doing a really basic SPA application using nodejs, expressjs and mongodb and i'm getting an MissingSchemaError when i'm trying to run the application. It seems my db schema is not detected properly. I thought it was a typo but its not i'm new to node js and mongodb so a littler help will be appreciated.
monitoring.model.js
const mongoose = require('mongoose');
var monitoringSchema = new mongoose.Schema({
techName: {
type: String
},
Customer: {
type: String
},
Description: {
type: String
}
});
mongoose.model('monitoring', monitoringSchema);
monitoringController.js
const express = require('express');
var router = express.Router();
const mongoose = require('mongoose');
const monitoring = mongoose.model('monitoring');
router.get('/', (req, res) => {
res.render("monitoring/addOrEdit", {
viewTitle : "Insert Problem"
});
});
router.post('/',(req, res) => {
console.log(req.body);
});
module.exports = router;