I am seeing many answers saying that the correct way to define an objectId type in a mongoose schema is like:
type: mongoose.Schema.Types.ObjectId
But from the mongoose docs they show that you can define an objectId type like so:
const carSchema = new mongoose.Schema({ driver: mongoose.ObjectId });
Is there something I am missing? What is the correct way to define an objectId type? Are both methods correct or one is outdated?