i have a mongoose schema like this
id: { type: String, required: true, unique: true, default: uniqueUUID },
description: { type: String },
period: {
id: { type: String, default: uuid.v1 },
start: { type: Date, default: Date.now },
due: { type: Date },
dueWarnByHours: { type: Number, integer: true },
newnessByHours: { type: Number, integer: true },
},
I want to remove all the elements under period embedded schema that matches the period.id.
i'm currently trying it like
WorkItem.remove({ 'id': workItemId, 'period.id': periodId }, function(err, callID) {
if (err) return console.error(err);
console.dir(callID + "Successfully removed the workItem from the database");
});
it's not working and it's not an array