title: mongoose instance method is undefined AFTER correctly ordering method definition and schema naming
body: <p>I defined an instance method on a schema that I can't seem to access. Before I go into details, I'll say that I have read [this question] (<a href="https://stackoverflow.com/questions/10724876/mongoose-instance-method-is-undefined">Mongoose instance method is undefined</a>), which had the same problem, but my root cause must be different.  I defined all instance methods before I connected the model to its name.</p>
  
  <p>First I defined a schema, and then defined an instance method:
      AccountSchema.methods.addFunds = function(amountToAd, callback) { 
          // do some stuff to add funds
          return callback();
      }</p>
  
  <p>At the bottom of that file, I associate the name to the schema:
      var exports = module.exports = Account = mongoose.model('Account', AccountSchema);</p>
  
  <p>For the record, just before associating the schema and name, I checked to make sure that AccountSchema.methods had my instance method.</p>
  
  <p>Later, I use Account.findOne to fetch an instance of an account:</p>
  
  <pre><code>AccountSchema.statics.login = function( email, password, callback) { 
  Account.findOne({ email:email}, function( err, doc){
          if(err) {
              console.log(err, null);
          } 
  
          // below is just some stuff to see if the doc is associated to the schema
          if(doc) {
              var keys = Object.keys(doc.schema);
              for(var propertyName in doc.schema) {
              console.log(propertyName + ":  " + doc[propertyName]);
          }
          // blah, do some other stuff
          callback(doc);
      }
  }
  </code></pre>
  
  <p>I include the snippet above because it looks like at the time I fetched the account from my db, it no longer has any instance methods.</p>
  
  <p>Finally, when I try to call doc.addFunds, I get:</p>
  
  <pre><code>TypeError: Object #&lt;Object&gt; has no method 'addFunds'
  </code></pre>
  
  <p>I'd appreciate any help or a link to a fully complete mongoose schema definition that uses instance methods.  </p>