Make the identation consistent for now

This commit is contained in:
Raymond Feng 2013-12-16 08:40:06 -08:00
parent aeecfa5551
commit 3d9061aa69
1 changed files with 30 additions and 30 deletions

View File

@ -383,51 +383,51 @@ DataAccessObject._coerce = function (where) {
return new OrigDate(arg); return new OrigDate(arg);
}; };
} else if (DataType === Boolean) { } else if (DataType === Boolean) {
DataType = function(val) { DataType = function(val) {
if(val === 'true') { if(val === 'true') {
return true; return true;
} else if(val === 'false') { } else if(val === 'false') {
return false; return false;
} else { } else {
return Boolean(val); return Boolean(val);
} }
}; };
} else if(DataType === Number) { } else if(DataType === Number) {
// This fixes a regression in mongodb connector // This fixes a regression in mongodb connector
// For numbers, only convert it produces a valid number // For numbers, only convert it produces a valid number
// LoopBack by default injects a number id. We should fix it based // LoopBack by default injects a number id. We should fix it based
// on the connector's input, for example, mongoddb should use string // on the connector's input, for example, MongoDB should use string
// while RDBs typically use number // while RDBs typically use number
DataType = function(val) { DataType = function(val) {
var num = Number(val); var num = Number(val);
return !isNaN(num) ? num : val; return !isNaN(num) ? num : val;
}; };
} }
if (!DataType) { if (!DataType) {
continue; continue;
} }
if (DataType === geo.GeoPoint) { if (DataType === geo.GeoPoint) {
// Skip the GeoPoint as the near operator breaks the assumption that // Skip the GeoPoint as the near operator breaks the assumption that
// an operation has only one property // an operation has only one property
// We should probably fix it based on // We should probably fix it based on
// http://docs.mongodb.org/manual/reference/operator/query/near/ // http://docs.mongodb.org/manual/reference/operator/query/near/
// The other option is to make operators start with $ // The other option is to make operators start with $
continue; continue;
} }
var val = where[p]; var val = where[p];
if(val === null || val === undefined) { if(val === null || val === undefined) {
continue; continue;
} }
// Check there is an operator // Check there is an operator
var operator = null; var operator = null;
if ('object' === typeof val) { if ('object' === typeof val) {
if (Object.keys(val).length !== 1) { if (Object.keys(val).length !== 1) {
// Skip if there are not only one properties // Skip if there are not only one properties
// as the assumption for operators is not true here // as the assumption for operators is not true here
continue; continue;
} }
for (var op in operators) { for (var op in operators) {
if (op in val) { if (op in val) {