'Why mongo show data object ID as string ID

I store Event collection as

const Event = new Schema({
  creator: { type: ObjectId, ref: "_User", required: true, index: true }
})

When I extract event data, some creators show as User Object. But some creators show as string "612267352379704de4c5552e". I want only object creators. Why do creators change from object to string.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source