Deep diffs two objects, including nested structures of arrays and objects, and returns the difference. ❄️
1.05k
stars
89
forks
source link
BUG: no difference detected when comparting two mongoose documents (ObjectId). #103
Open
soknifedev opened 3 months ago
When comparing two mongoose models whose _id or discriminated docs arent equal, the library returns no differences.
Steps to reproduce: (pseudo code)
1.Find a document
Perform an update and find document again
Compare differences between original and latestDocument.
Output: (prints no differences)
{}
Expected output: (should print the difference)
This bug may be fixed by changing the
isEmpty
utility function:const isEmpty = o => Object.keys(o).length === 0;
It is returning zero because "ObjectId" is a class without "keys", but it can be readed as a string perfectly.