If I define a model in mongoose, and create a document using something like the code below:
const Model = require("./Model")
const newModelItem = new Model({
...data
})
await newModelItem.save()
I noticed that there is an ID field immediately available in the newModelItem object.
How does MongoDB ensure that the key isn't a duplicate?