title: Schema hasn't been registered for model. Mongodb>Mongoose
body: <p>Hi my code is shown below:</p>
  
  <pre><code>var mongoose=require('mongoose');
  mongoose.connect('mongodb://localhost/test');
  
  var Schema=mongoose.Schema
  , ObjectId=Schema.ObjectId;
  
  var BlogPost= new Schema({
      author:ObjectId,
      title:String,
      body:String,
      date:Date
      });
  
  var myModel =mongoose.model('BlogPost','BlogPost');
  console.log(myModel);
  </code></pre>
  
  <p>Need advise. I am always getting this exception. </p>
  
  <pre><code>  500 MissingSchemaError: Schema hasn't been registered for model "BlogPost".&lt;br/&gt;Use mongoose.model(name, schema)
  </code></pre>