title: Using a Mongoose model defined in another file returns Undefined
body: <p>It seems pretty clear that defining a model in one file but using it in another is common practice. I don't know why I'm having so much trouble getting it to work. I spent the morning rewriting my simple MongoDB app to follow what I thought was a <a href="https://stackoverflow.com/questions/9230932/file-structure-of-mongoose-nodejs-project?rq=1">dead simple example</a>. I'm just structuring it like the top answer with the added convenience that the file where I define the Schema and Model and access the Model are in the same folder (because the project is so small and I'm just learning MongoDB). I think part of the problem as I tried researching solutions is that other examples really complex to follow. The DB connects as expected and I can work in the <code>ManageDB.js</code> file fine, but of course want to keep the project organized, even at my small scale. (The server.js file in the directory above connects before this code executes.)</p>
  <p>What other things can I try to troubleshoot this MongoDB application?</p>
  <pre><code>// src/ManageDB.js
  
  const mongoose = require('mongoose');
  
  const devTweetRecordsModel = new mongoose.Schema({
      time: Date,
      text: String,
      source: String,
      positive: Number,
      negative: Number,
  });
  var tweetdb = mongoose.model('DevTweetDB', devTweetRecordsModel);
  
  module.exports = {
      tweetdb: tweetdb
  };
  
  
  // src/TwitterAPI.js
      
  const mongoose = require('mongoose');
  var tweetdb = require('../src/ManageDB').tweetdb;
  
  console.log(tweetdb); // Returns undefined
  </code></pre>