Scheduler deletes my mongodb data _id, and replaces with id!

Hi there. Scheduler loses my data _id but rest of the values in my data are well_kept, and adds an id that is not compatible with ObjectID given it is only 12 characters(I think). Nonetheless, it has nothing to do with my original data _id, hence I can not findByIdAndUpdate using mongoose, given the id is different than the database for some reason. Could you please help me with this?

Thank you!

Hi,

It you have property “_id” in data, seems you need to replace it with “id”. Because “id” is mandatory property and if you don’t specify it, it will be generated automatically and the value will be set randomly like 1538142335391.
https://docs.dhtmlx.com/scheduler/loading_data.html#dataproperties

Hi Polina,

Thank you for your prompt reply! :slight_smile:

I understand that it creates a new id, but the problem is why is it deleting the original _id?? I need that to update my events. Is it because mongodb stores data with id of ObjectID("…") ? What can I do about this?

Sheduler will discard properties that start with _ or with $ while loading data. So this property “_id” can’t be sent to the server.
You need to write this value into the event.id property when you load event to Scheduler. I.e. event.id <-> event._id.