mongoose-findorcreate icon indicating copy to clipboard operation
mongoose-findorcreate copied to clipboard

When removing query operators, only remove keys starting with dollar.

Open binki opened this issue 2 years ago • 0 comments

The changes introduced in #6 were intended to allow callers to do things like the following:

Model.findOrCreate({ key: '0', value: { $exists: false } })

However, its implementation prevented values contining the dollar sign from being included.

This change preserves the behavior of removing query operators by recursively finding any property starting with a dollar and removing it. This allows values containing the dollar sign to be upserted while still omiting query operators.

Fixes #30.

binki avatar May 07 '22 17:05 binki