modm
Advanced tools
Comparing version 0.2.1 to 0.2.2
@@ -128,5 +128,5 @@ var valify = require('./manipulator'); | ||
// check if required fields exists | ||
// check if required fields exists when insert or upsert | ||
// TODO it could be, that not all required fields are in the document on an upsert. | ||
if (self._schema.required && method === 'insert' || (method === 'update' && (args[2] && args[2].upsert || !args[docIndex].$set))) { | ||
if (self._schema.required && method === 'insert' || (method === 'update' && (args[2] && args[2].upsert || (Object.keys(args[docIndex])[0] || "")[0] !== '$'))) { | ||
for (var i = 0, l = self._schema.required.length; i < l; ++i) { | ||
@@ -133,0 +133,0 @@ if(self._schema.required[i] !== '_id' && typeof result[2][self._schema.required[i]] === 'undefined') { |
@@ -73,3 +73,3 @@ // INFO: results of atomic operations are not validated. | ||
if (options[manipulator]) { | ||
if (manipulator in options) { | ||
@@ -76,0 +76,0 @@ result = manipulators[manipulator](options[manipulator], value); |
{ | ||
"name": "modm", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"author": "Adrian Ottiker <adrian@ottiker.com>", | ||
@@ -5,0 +5,0 @@ "description": "A MongoDB Object Document Mapper (ODM)", |
@@ -65,1 +65,9 @@ MODM | ||
live: true // false | ||
####License | ||
"THE BEER-WARE LICENSE" (Revision 42): | ||
adrian@ottiker.com wrote this code. As long as you retain this notice you | ||
can do whatever you want with this stuff. If we meet some day, and you think | ||
this stuff is worth it, you can buy me a beer in return. |
Sorry, the diff of this file is not supported yet
35679
73