MongoDB - Error: document must have an _id before saving : <p>I've been struggling so much with this project. I am following a tutorial that is out of date in some areas, for instance their version of Jquery used a totally different format for some functions and I had to do a lot of changing around. But I think I am down to one last major problem that I can't seem to find a fix for. In my Schema variable I've got the _id, username, and password types</p>

<pre><code>var UserSchema = new mongoose.Schema({
    _id: mongoose.Schema.ObjectId,
    username: String,
    password: String
}); 
</code></pre>

<p>but when I go to try to add a new user to my app, instead of getting the alert I am supposed to get, it pops up as [object Object] and nothing gets added to the database. Then this error pops up in the mongo cmd </p>

<blockquote>
  <p>"Error: document must have an _id before saving".</p>
</blockquote>

<p>I've tried commenting out the _id line and I get the right message but still nothing shows up in my database.</p>
