Hi! I’m new to MongoDB, so I don’t know if the following is the correct behavior or not.
I have a collection of games which I imported straight from IGDB’s API. As far as I can see, all objects that are inside an array have been assigned their own ObjectId by MongoDB. Yet, when I insert a new object into an array myself using Shell, no ObjectId is generated. Is this right? Or should MongoDB be assigning a new ObjectId to the object I’m inserting, and for some reason it’s not doing so? An example:
genres: Array (2)
0: Object // Object imported from database
id: 123
name: “action”
_id: ObjectId(‘123456abcdfg’) // ObjectId assigned by MongoDB1: Object // Object inserted manually
id: 124
name: “adventure”
// No ObjectId
If this is normal, then I can assume the object not having its own ObjectId shouldn’t cause any problems? And if it’s not, why does it happen, and how can I fix it?
Thank you!