title: Mongoose create a new object within a static function
body: <p>How do I create a new object within one of my static methods defined in the schema?</p>
  
  <p>I basically have </p>
  
  <pre><code>UserSchema.statics.createUser = function (username, password, cb) { .. }
  </code></pre>
  
  <p>And I want to be able to save a new instance of the user object inside the function. I want to do something like <code>var user = new User(...)</code> within that method, but it of course doesn't work because the User model was not yet created.</p>
  
  <p>What do I do?</p>