Meteor-Community-Packages / meteor-collection2

A Meteor package that extends Mongo.Collection to provide support for specifying a schema and then validating against that schema when inserting and updating.
https://packosphere.com/aldeed/collection2
MIT License
1.02k stars 108 forks source link

Fix bug where upserts with query operators fail #398

Closed coagmano closed 4 years ago

coagmano commented 4 years ago

Upserts with operators were having the operators copied into the object for validation causing validation to fail. This commit naively removes omits all keys from the selector if they start with or contain an object with keys starting with "$". The new code only searches one level deep.

This should fix the issue found on the forums here: https://forums.meteor.com/t/simpl-schema-update-error-while-using-lte-operator-when-calling-update-by-the-field-of-type-date/50414