mongoose-diff-history
mongoose-diff-history copied to clipboard
Omit path not working with array of subdocuments
Hi. I have a document, its schema looks like this.
new mongoose.Schema({
items: [
{
name: String,
currentValue: Number
}],
totalCurrentValue: Number,
}, {timestamps: true});
I've added items.currentValue
and totalCurrentValue
to the omit options, and its omitting totalCurrentValue
correctly, but its not ignoring changes on 'items.currentValue'.
Note: By default, mongoose adds and _id field on every array item, i've checked it, and the _id its not modified, because i'm only modifying the currentValue field, sometimes adding it or removing or just updating, and not modifying the entire array, so this its not the reason of the issue.
The diff object looks like this, when i add the items.currentValue'
field.
{
items: {
0: {
currentValue: 2,
},
_t: "a"
}
Thanks in advice
I can create a pr, just let me know which files i need to change or its not a real issue