Skip to content

Commit

Permalink
$atomic -> $conditional
Browse files Browse the repository at this point in the history
  • Loading branch information
aheckmann committed Feb 24, 2012
1 parent 3ff7e82 commit f928c31
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/query.js
Expand Up @@ -1178,10 +1178,11 @@ Query.prototype._walkUpdatePath = function _walkUpdatePath (obj, op, pref) {
* @param {Schema} schema
* @param {Object} val
* @param {String} op - the atomic operator ($pull, $set, etc)
* @param {String} [$conditional]
* @private
*/

Query.prototype._castUpdateVal = function _castUpdateVal (schema, val, op, $atomic) {
Query.prototype._castUpdateVal = function _castUpdateVal (schema, val, op, $conditional) {
if (!schema) {
// non-existing schema path
return op in numberOps
Expand All @@ -1203,7 +1204,7 @@ Query.prototype._castUpdateVal = function _castUpdateVal (schema, val, op, $atom
}

if (op in numberOps) return Number(val);
if (/^\$/.test($atomic)) return schema.castForQuery($atomic, val);
if (/^\$/.test($conditional)) return schema.castForQuery($conditional, val);
return schema.castForQuery(val)
}

Expand Down

0 comments on commit f928c31

Please sign in to comment.