Check for null & undefined values
This commit is contained in:
parent
fab504b5d9
commit
9890af119e
|
@ -407,6 +407,9 @@ DataAccessObject._coerce = function (where) {
|
||||||
}
|
}
|
||||||
|
|
||||||
var val = where[p];
|
var val = where[p];
|
||||||
|
if(val === null || val === undefined) {
|
||||||
|
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) {
|
||||||
|
|
|
@ -654,6 +654,14 @@ describe('DataAccessObject', function () {
|
||||||
assert.deepEqual(where, {location: {near: {lng: 10, lat: 20}, maxDistance: 20}});
|
assert.deepEqual(where, {location: {near: {lng: 10, lat: 20}, maxDistance: 20}});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should skip null or undefined values', function () {
|
||||||
|
where = model._coerce({date: null});
|
||||||
|
assert.deepEqual(where, {date: null});
|
||||||
|
|
||||||
|
where = model._coerce({date: undefined});
|
||||||
|
assert.deepEqual(where, {date: undefined});
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Load models from json', function () {
|
describe('Load models from json', function () {
|
||||||
|
|
Loading…
Reference in New Issue