title: How to insert a doc into mongodb using mongoose and get the generated id?
body: <p>I'm using mongoose to operate mongodb. Now, for testing, I want to inserting some data into mongodb by native connection.</p>
  
  <p>But the question is how to get the generated id after inserting?</p>
  
  <p>I tried:</p>
  
  <pre><code>var mongoose = require('mongoose');
  
  mongoose.connect('mongo://localhost/shuzu_test');
  
  var conn = mongoose.connection;
  
  var user = {
      a: 'abc'
  };
  
  conn.collection('aaa').insert(user);
  
  console.log('User:');
  console.log(user);
  </code></pre>
  
  <p>But it prints:</p>
  
  <pre><code>{ a: 'abc' }
  </code></pre>
  
  <p>There is no <code>_id</code> field.</p>