tdegrunt/jsonschema — pull request #24 by ManThursday (2013-01-21 13:46:30+00:00)
Title: Conditional assignment of properties to object instance

I've been having issues with using jsonschema with the MongoDB node driver since the refactor to allow values to be updated. The problem is that the node driver coerces undefined values into null values when creating the BSON document. The refactored jsonschema code is assigning any properties not already defined in the object instance with the return value of validateSchema. In other words between jsonschema and MongoDB all unspecified properties were being inserted with a value of null.

I've added inequality checks to the the updates so that if both values are undefined then no assignment occurs and the property will remain undefined in the Mongo BSON document.