Its pretty simple:
- If you have declared _id field explicitly in schema, you must initialize it explicitly
- If you have not declared it in schema, MongoDB will declare and initialize it.
What you can’t do, is to have it in the schema but not initialize it. It will throw the error you are talking about