title: How to find a collection with mongoose
body: <p>I use mongoose and express library to call API to get mongodb data.</p>
  
  <p>This code i use API can get the data as well if i give up to use <code>Schema</code></p>
  
  <pre><code>const Driver = require('../models/driver');
  const mongoose = require('mongoose');
  // If i don't use Schema by using connection can get collection data
  const connection = mongoose.connection;
  
  module.exports = {
      gretting (req, res, next) {
  
          const { theater } = req.query;
          connection.db.collection(theater, (err, collection) =&gt; {
              collection.find({}).toArray((err, data) =&gt; {
                  res.send(data);
              });
          });
      }
  </code></pre>
  
  <p>If i use Schema, this code i try i will get an empty object</p>
  
  <pre><code>module.exports = {
      gretting (req, res, next) {
          // I set the collection name is Tainan
          Driver.find()
              .then(movie =&gt; res.send(movie))
              .catch(next);
      }
  </code></pre>
  
  <p>Here is my Shecma code:</p>
  
  <pre><code>const mongoose = require('mongoose');
  const Schema = mongoose.Schema;
  
  const PointSchema = new Schema({
      type: { type: String, default: 'Point'},
      coordinates: { type: [Number], index: '2dsphere'}
  });
  
  const MovieSchema = new Schema({
      theater: String,
      phone: String,
      movie: {
          film: {
              moviePhoto: [],
              movieStills: [],
              movieActorPhoto: [],
              movieActorCn: [],
              movieDate: [],
              versionType: [],
              cnName: [],
              movieTime: [],
              movieContent: [],
              movieStyle: [],
              releasedTime: [],
              enName: []
          }
      },
      theaterPhoto: String,
      address: String,
      theaterCn: String,
      geometry: PointSchema
  });
  
  const Driver = mongoose.model('Tainan', MovieSchema);
  
  module.exports = Driver;
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/6Axfu.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6Axfu.png" alt="enter image description here"></a></p>
  
  <p>This my main file app.js using promise:</p>
  
  <pre><code>const express = require('express');
  const bodyParser = require('body-parser');
  const mongoose = require('mongoose');
  const routes = require('./routes/routes');
  const app = express();
  
  mongoose.Promise = global.Promise;
  if (process.env.NODE_ENV !== 'test') {
      mongoose.connect('mongodb://localhost/movies');
  }
  app.use(bodyParser.json());
  routes(app);
  app.use((err, req, res, next) =&gt; {
      res.status(422).send({ error: err.message });
  });
  
  module.exports = app;
  </code></pre>
  
  <p>Any one knows how to get my collection data in my case ?</p>
  
  <p>Also if i want to get the specified field data what should i do ?</p>
  
  <p>I try this code but its still an empty object</p>
  
  <pre><code>module.exports = {
      gretting (req, res, next) {
          Driver.find({ "theater": "TodayTainan" })
              .then(movie =&gt; res.send(movie))
              .catch(next);
      }
  </code></pre>
  
  <p>Any help would be appreciated. Thanks in advance.</p>