title: How can I generate an ObjectId with mongoose?
body: <p>I'd like to generate a MongoDB <code>ObjectId</code> with Mongoose. Is there a way to access the <code>ObjectId</code> constructor from Mongoose?</p>
  
  <ul>
  <li><p>This question is about <strong>generating a new</strong> <code>ObjectId</code> from scratch. The generated ID is a brand new universally unique ID.</p></li>
  <li><p>Another question asks about creating an <code>ObjectId</code> from an <strong>existing string representation</strong>. In this case, you already have a string representation of an ID—it may or may not be universally unique—and you are parsing it into an <code>ObjectId</code>.</p></li>
  </ul>