dimsemenov / Magnific-Popup

Light and responsive lightbox script with focus on performance.
http://dimsemenov.com/plugins/magnific-popup/
MIT License
11.38k stars 3.49k forks source link

<constant>.find({}) is not a function #1099

Closed nadim-khan closed 4 years ago

nadim-khan commented 5 years ago

console.log("**"+'\n'+'\t'+" Server Started "+'\n'+"**"+'\n\n'); const express = require('express'); const router = express.Router(); const mongoose= require('mongoose'); const Video= require('../models/videos');

const db="mongodb://:@ds227654.mlab.com:27654/videos" mongoose.Promise=global.Promise;

mongoose.connect(db, function(err){ if(err){ console.log('ERROR ! '+'\n' + ' DB Error : '+err); } else{ console.log ('Connected to Database'); } })

//Testing api router.get('/',function(req,res){ res.send('Application Works'); });

router.get('/videos', function(req, res){ console.log('\n'+"Get request for all the videos "+'\n'); Video.find({}) .exec(function(err, videos){ if(err){ console.log('\n'+"Error retreiving Videos "+'\n'+"Error : "+err); } else{ res.json(); } }); });

module.exports = router;

I am getting the error

TypeError: Video.find is not a function