Regarding your question:
Also how can we Disable Default MongoDB ObjectID's Generation and _v?`
Setting versionKey
to false
in your schema will disable versioning.
const mySchema = new mongoose.Schema({
someField: String
}, { versionKey: false });
All top-level documents require an _id
. The _id
serves as the primary key.
Note: autoIndexId: false
only worked in older versions of MongoDB (before v3.4)