I need to save document to my db. Document has different fields and one of them "id".
looks like this
"is_trial_product": 0,
"is_shippable": 1,
"tax_code": null,
"is_licensed": 0,
"id": 1,
"name": "Product 1",
"description": "bla bla bla",
"price": "44.9500",
problem is when I use method Product.insertMany(...) and passing in array with my products it gets saved but deletes "id" from every document.
I'm getting results like this
"is_trial_product": 0,
"is_shippable": 1,
"tax_code": null,
"is_licensed": 0,
"name": "Product 1",
"description": "bla bla bla",
"price": "44.9500",
I'm using this schema. Strict false and schema is empty because Product could have unpredictable fields so I don't want to specify them for now.
const TestProductSchema = new Schema({}, { strict: false, timestamps: true });
I tried options like
{ id: false }
{ _id: false }
but it didn't help.
Maybe somebody know why is it happening and if there is a way to avoid it?