Concept Flow - Custom _id values
Start Insert Document
Check if _id provided?
No→Generate default ObjectId
Yes
Use provided _id value
Insert document with _id
Document stored in collection
When inserting a document, MongoDB checks if you provide an _id. If yes, it uses that value; if no, it creates a default ObjectId.