title: How to query all data with mongoose Schema?
body: <p>My website is developed as Node.js, Express.js, and MySQL.
  Recently, I have been working on converting MySQL DB to MongoDB, and there is a problem connecting MongoDB data.</p>
  
  <p>I am using Mongoose, MongoDB ODM, and I read Mongoose's document and wrote the same code, but I cannot get the data.
  Maybe there is a problem with schema setting or DB connection process, so I wonder how to solve it.</p>
  
  <p>The data structure in my DB consists of the following.
  <a href="https://i.stack.imgur.com/fbARB.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fbARB.png" alt="MongoDB Compass"></a></p>
  
  <p><strong>[index.js]</strong></p>
  
  <pre><code>const db = require("../lib/db");
  let User = require('../lib/models/userModel');
  router.get("/", function (req, res, next) {
    console.log(`HOME ROUTE!`);
    User.find(),  // Find All data in user collection
      function (err, result) {
        if (err) return handleError(err);
        console.log(result);
      }
  });
  </code></pre>
  
  <p><strong>[userModel.js]</strong></p>
  
  <pre><code>var mongoose = require("mongoose");
  var Schema = mongoose.Schema;
  mongoose.set('useCreateIndex', true)
  
  const userSchema = new Schema({
    _id: String,
    login: String,
    id: {
      type: Number,
      unique: true
    }
  });
  console.log('Module Success')
  
  module.exports = mongoose.model("User", userSchema);
  </code></pre>
  
  <p><strong>[db.js]</strong></p>
  
  <pre><code>const mongoose = require('mongoose');
  mongoose.connect(process.env.MONGO_URI, {
    useNewUrlParser: true,
    useUnifiedTopology: true
  });
  
  let db = mongoose.connection;
  db.on('error', console.error.bind(console, 'connection error:'));
  db.once('open', function() {
    // we're connected!
    console.log('DB Connected');
  });
  
  module.exports = db;
  </code></pre>
  
  <p><strong>[Log when connecting to Home route]</strong><br>
  <a href="https://i.stack.imgur.com/7677b.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7677b.png" alt="enter image description here"></a></p>
  
  <p>As you can see, there are no results printed on the console, but there are no error phrases, so I don't know where the problem occurs.</p>