title: NodeJS Express Mongoose return empty []
body: <p>I tried to make a MEAN stack app, but my API fails to give my requested data.</p>
  
  <p>server.js file:</p>
  
  <pre><code>const express = require("express");
  const bodyparser = require("body-parser");
  const mongoose = require('mongoose');
  const dotenv = require('dotenv');
  dotenv.config();
  const port = process.env.PORT; 
  const dburi = process.env.DB_URI; 
  
  //Routes
  const volcanoesRoute = require('./api/routes/volcano.routes');
  
  mongoose.Promise = global.Promise;
  
  mongoose.connect(
    dburi,
    {
      useNewUrlParser: true,
      useUnifiedTopology: true,
      useFindAndModify: false,
      useCreateIndex: true,
    },
  ).then(
    () =&gt; {
      console.log('Connected to mongoDB');
    },
    (err) =&gt; console.log('Error connecting to mongoDB', err),
    { useNewUrlParser: true }
  );
  
  
  //Express app
  const app = express();
  
  app.use(bodyparser.json());
  app.use(bodyparser.urlencoded({ extended: false }));
  app.use('/api/vulcanoes', volcanoesRoute);
  app.listen(port, () =&gt; {
    console.log(`running at port ${port}`);
  });
  </code></pre>
  
  <p>Routes file:</p>
  
  <pre><code>const express = require('express');
  const volcanoController = require('../controllers/volcanoController');
  const router = express.Router();
  
  router.get('/getallvulcanoes', volcanoController.getAllVolcanoes);
  
  module.exports = router;
  </code></pre>
  
  <p>Controller file:</p>
  
  <pre><code>const VolcanoSchema = require('../models/volcano.models');
  
  const getAllVulcanoes = (req, res) =&gt; {
      VolcanoSchema.find((err, results) =&gt; {
        if (err) {
          console.log(err);
          res.status(500).json({message: err});
        } else {
          res.status(200).json(results);
        }
      });
    };
  
    module.exports = {getAllVolcanoes};
  </code></pre>
  
  <p>Model file</p>
  
  <pre><code>const mongoose = require('mongoose');
  
  const VolcanoSchema = new mongoose.Schema({
      Volcano_name:{
          type: String,
      },
      Country:{
          type: String,
      },
      Type:{
          type: String,
      },
      Latitude:{
          type: Number,
      },
      Longtitude:{
          type: Number,
      },
      Elevation:{
          type: Number,
      },
  });
  
  module.exports = mongoose.model('Volcano', VolcanoSchema);
  </code></pre>
  
  <p>The thing is that i have a working example but most of the code is decrepitated... but it the respond is always giving me this </p>
  
  <p><a href="https://i.stack.imgur.com/p7OWV.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/p7OWV.jpg" alt="request example"></a></p>
  
  <p>It would be nice if someone point out what i am doing wrong </p>
  
  <p>EDIT: I switched to postgresql for my database hopefully this will work</p>