title: mongoose and q promises
body: <p>I'm working from the mongoose/q promises framework sample <a href="https://gist.github.com/2660323" rel="nofollow">here</a>, but seem to have some issues with the nfbind when trying to use findOne, mainly since the samples from the <a href="https://github.com/kriskowal/q" rel="nofollow">Q</a> framework don't seem to match those in the gist.</p>
  
  <p>My code:</p>
  
  <pre><code>var mongoose = require('mongoose');
  var Q = require('q');
  
  var user_schema = mongoose.Schema({username:String, last_touched:Date, app_ids:[String]});
  var user = mongoose.model('user', user_schema);
  
  exports.user = user;
  exports.user.find = Q.nfbind(user.find);
  exports.user.findOne = Q.nfbind(user.findOne);
  </code></pre>
  
  <p>If I call <code>user.findOne({username:'test'}).then(function(err, user) { ... }</code>, the user is always undefined.  If I remove the export and use the non-promise version with callbacks, I get the user.  I'm missing some special magic, but after looking at the code implementation, the example on from the Q github, and from the mongoose demo...  Nothing really jumps out.  Any ideas as to how I get to make a <code>findOne</code> work with Q?</p>
  
  <p>I have also tried to set the <code>nfbind</code> functions up in the source rather than in the module, but to no avail.</p>