Skip to content

Commit

Permalink
fix(near): allow max and min float values
Browse files Browse the repository at this point in the history
  • Loading branch information
Hans Kristian Flaatten committed Aug 6, 2016
1 parent f913baa commit eeae510
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ module.exports.prototype.customNear = field => (query, point) => {

if (pointArr.length >= 2) {
if (!isNaN(pointArr.reduce((a, b) => a + b))) {
const max = parseInt(pointArr[2], 10);
const min = parseInt(pointArr[3], 10);
const max = pointArr[2];
const min = pointArr[3];

query[field] = {
$near: {
Expand Down
6 changes: 3 additions & 3 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ describe('customNear()', () => {
type: 'Point',
coordinates: point.split(',').splice(0, 2).map(parseFloat, 10),
},
$maxDistance: parseInt(point.split(',')[2], 10),
$maxDistance: parseFloat(point.split(',')[2], 10),
},
},
});
Expand All @@ -98,8 +98,8 @@ describe('customNear()', () => {
type: 'Point',
coordinates: point.split(',').splice(0, 2).map(parseFloat, 10),
},
$maxDistance: parseInt(point.split(',')[2], 10),
$minDistance: parseInt(point.split(',')[3], 10),
$maxDistance: parseFloat(point.split(',')[2], 10),
$minDistance: parseFloat(point.split(',')[3], 10),
},
},
});
Expand Down

0 comments on commit eeae510

Please sign in to comment.