Quantcast
Channel: Mongoose model is not returning data - Stack Overflow
Viewing all articles
Browse latest Browse all 2

Answer by Shaishab Roy for Mongoose model is not returning data

$
0
0

In find function first parameters is query condition then apply callback.

so you should use query condition {} to get all records or can apply your query. so should use NickiNumber.find({}, function(...

Query should be like:

var express = require('express');var router = express.Router();var NickiNumber = require('../models/nickinumbers');router.get('/', function(req, res) {        NickiNumber.find({}, function(err, nums) {            if (err) return console.error(err);            res.render('index', {title: 'Users', nums: nums});    }); });module.exports = router;

Viewing all articles
Browse latest Browse all 2

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>