title: What is the difference between mongoose.ObjectId and mongoose.Types.ObjectId?
body: <p>It's mentioned in the docs the following:</p>
  <blockquote>
  <p>An ObjectId is a special type typically used for unique identifiers...</p>
  </blockquote>
  <pre><code>const carSchema = new mongoose.Schema({ driver: mongoose.ObjectId });
  </code></pre>
  <blockquote>
  <p><strong>ObjectId</strong> is a class, and ObjectIds are objects....etc</p>
  </blockquote>
  <pre><code>const Car = mongoose.model('Car', carSchema);
  
  const car = new Car();
  car.driver = new mongoose.Types.ObjectId();
  
  typeof car.driver; // 'object'
  car.driver instanceof mongoose.Types.ObjectId; // true
  
  car.driver.toString(); // Something like &quot;5e1a0651741b255ddda996c4&quot;
  </code></pre>
  <p>What is meant by ObjectId (the bold text above in the quote)? is it <code>mongoose.ObjectId</code> or <code>mongoose.Types.ObjectId?</code></p>
  <p>And what's the difference between them?</p>
  <p>The URL of the docs:</p>
  <p><a href="https://mongoosejs.com/docs/schematypes.html#usage-notes" rel="nofollow noreferrer">https://mongoosejs.com/docs/schematypes.html#usage-notes</a></p>
  <p>at the ObjectIds section</p>