Fixes issue affecting liveQuery on location null/undefined values (#4171)

This commit is contained in:
Florent Vilmart
2017-09-17 04:57:11 -04:00
committed by Natan Rolnik
parent d0184f438d
commit 8d8a8b250e
2 changed files with 28 additions and 1 deletions

View File

@@ -262,10 +262,16 @@ function matchesKeyConstraints(object, key, constraints) {
}
break;
case '$nearSphere':
if (!compareTo || !object[key]) {
return false;
}
var distance = compareTo.radiansTo(object[key]);
var max = constraints.$maxDistance || Infinity;
return distance <= max;
case '$within':
if (!compareTo || !object[key]) {
return false;
}
var southWest = compareTo.$box[0];
var northEast = compareTo.$box[1];
if (southWest.latitude > northEast.latitude ||