title: load a user based on id with mongoose
body: <p>I'm trying to figure out how to load a user based on ID with mongoose in a node application. I come from a php/mysql background and I'm having a hard time figuring out how to tie this all together in node+mongoose. Can someone help me to improve/fix this example? </p>
  
  <p>Model models/user.js</p>
  
  <pre><code>var mongoose = require('mongoose')
      , Schema = mongoose.Schema;
  
  var userSchema = new Schema({
      facebookProfile: {},
      facebookPages: { type: Array },
      created: {type: Date, default: Date.now}
  });
  
  userSchema.methods = {
      getManagedPages: function(){
          return this.facebookPages;
      }
  }
  
  userSchema.statics = {
      load: function(userid){
              return this.findById(userid);
      }
  }
  module.exports = mongoose.model('User', userSchema);
  </code></pre>
  
  <p>in the controller controllers/user.js</p>
  
  <pre><code>var User = mongoose.model("User");
  var currentUser = new User();
  currentUser = currentUser.load(req.user._id);
  </code></pre>
  
  <p>The error I'm getting is: </p>
  
  <blockquote>
    <p>TypeError: Object { _id: 52861322f38d7ded3f000001, created: Fri Nov 15
    2013 13:27:14 GMT+0100 (CET), facebookPages: [] } has no method 'load'
    at exports.profile</p>
  </blockquote>