title: mongoose Model.findOne TypeError: Object has no method 'findOne'
body: <p>I have a simple node.js code that uses mongoose which works when saving but doesn't retrieve.</p>
  
  <p><code>.save()</code> works, but <code>.findOne()</code> doesn't.</p>
  
  <pre><code>mongoose = require('mongoose');
  mongoose.connect("mongodb://localhost/TestMongoose");
  UserSchema = new mongoose.Schema({
      field: String
      });
  Users = mongoose.model('userauths', UserSchema);
  
  user = new Users({
      field: 'value'
      });
  
  //user.save();  
  </code></pre>
  
  <p>^ works. i.e. updates the database with values. <a href="https://i.stack.imgur.com/ZTEvA.png" rel="noreferrer">screenshot</a></p>
  
  <hr>
  
  <pre><code>//user.findOne({field:'value'},function(err,value){});
  </code></pre>
  
  <p>^ Throws error:</p>
  
  <pre><code>user.findOne({field:'value'},function(err,value){});
       ^
  TypeError: Object { field: 'value', _id: 52cd521ea34280f812000001 } has no method 'findOne'
      at Object.&lt;anonymous&gt; (C:\localhost\nodeTest\z.js:16:6)
      at Module._compile (module.js:456:26)
      at Object.Module._extensions..js (module.js:474:10)
      at Module.load (module.js:356:32)
      at Function.Module._load (module.js:312:12)
      at Function.Module.runMain (module.js:497:10)
      at startup (node.js:119:16)
      at node.js:901:3
  </code></pre>
  
  <hr>
  
  <pre><code>console.log(JSON.stringify(   user    , null, 40));
  </code></pre>
  
  <p>^ returns just the object <code>{field: 'value'}</code></p>
  
  <pre><code>console.log(JSON.stringify(   Users   , null, 40));
  </code></pre>
  
  <p>^ returns <code>undefined</code></p>
  
  <pre><code>Users.findOne();
  </code></pre>
  
  <p>^ no error, but doesn't return anything.<br>
  (so does the function <code>findOne()</code> exists in <code>Users</code>? but so why then does <code>console.log(..Users..</code> returns <code>undefined</code>?)</p>
  
  <p>What could be the issue causing <code>findOne()</code> to not work as expected?</p>