nodejs-datastore icon indicating copy to clipboard operation
nodejs-datastore copied to clipboard

fix: not check index exclusion path for `null` values

Open mrnagydavid opened this issue 1 year ago • 0 comments

This PR fixes issue #1327 🦕

Summary

Considering the following 4 types of index exclusions:

  1. excludeFromindexes: ['foo.*']
  2. excludeFromindexes: ['foo.bar']
  3. excludeFromindexes: ['foo[].*']
  4. excludeFromindexes: ['foo[].bar']

Supplying { entity: { foo: null } } throws for 2 and 3, but not for 1 and 4.

save({ excludeFromIndexes: ['foo.bar'], entity: { sho: 1, foo: null })
// throws TypeError: Cannot read properties of undefined (reading 'properties')

save({ excludeFromIndexes: ['foo[].*'], entity: { sho: 1, foo: null })
// throws TypeError: Cannot read properties of undefined (reading 'values')

With the changes in this PR, the save calls will not throw in any of the 4 cases.

mrnagydavid avatar Oct 04 '24 09:10 mrnagydavid