Comparing version 0.1.3 to 0.2.0
0.2.0 / 2013-07-05 | ||
================== | ||
* use $geoWithin by default | ||
0.1.2 / 2013-07-02 | ||
================== | ||
* added use$geoWithin flag [ebensing](https://github.com/ebensing) | ||
* fix read preferences typo [ebensing](https://github.com/ebensing) | ||
* fix reference to old param name in exists() [ebensing](https://github.com/ebensing) | ||
0.1.1 / 2013-06-24 | ||
@@ -3,0 +15,0 @@ ================== |
@@ -69,9 +69,23 @@ 'use strict'; | ||
/** | ||
* This is a parameter that the user can set which will decided whether mquery | ||
* uses $within or $geoWithin for these queries. It defaults to false, which | ||
* means $within will be used. | ||
* This is a parameter that the user can set which determines if mquery | ||
* uses $within or $geoWithin for queries. It defaults to true which | ||
* means $geoWithin will be used. If using MongoDB < 2.4 you should | ||
* set this to false. | ||
* | ||
* @api public | ||
* @property use$geoWithin | ||
*/ | ||
Query.use$geoWithin = false; | ||
var $withinCmd = '$geoWithin'; | ||
Object.defineProperty(Query, 'use$geoWithin', { | ||
get: function ( ) { return $withinCmd == '$geoWithin' } | ||
, set: function (v) { | ||
if (true === v) { | ||
// mongodb >= 2.4 | ||
$withinCmd = '$geoWithin'; | ||
} else { | ||
$withinCmd = '$within'; | ||
} | ||
} | ||
}); | ||
@@ -677,9 +691,4 @@ /** | ||
this._ensurePath('within'); | ||
this._geoComparison = $withinCmd; | ||
if (Query.use$geoWithin) { | ||
this._geoComparison = '$geoWithin'; | ||
} else { | ||
this._geoComparison = '$within'; | ||
} | ||
if (0 === arguments.length) { | ||
@@ -751,3 +760,3 @@ return this; | ||
var conds = this._conditions[path] || (this._conditions[path] = {}); | ||
conds[this._geoComparison || "$within"] = { '$box': box }; | ||
conds[this._geoComparison || $withinCmd] = { '$box': box }; | ||
return this; | ||
@@ -786,3 +795,3 @@ } | ||
var conds = this._conditions[path] || (this._conditions[path] = {}); | ||
conds[this._geoComparison || "$within"] = { '$polygon': val }; | ||
conds[this._geoComparison || $withinCmd] = { '$polygon': val }; | ||
return this; | ||
@@ -835,3 +844,3 @@ } | ||
var wKey = this._geoComparison || "$within"; | ||
var wKey = this._geoComparison || $withinCmd; | ||
conds[wKey] = {}; | ||
@@ -977,4 +986,4 @@ conds[wKey][type] = [val.center, val.radius]; | ||
if (!('$within' == this._geoComparison || | ||
'$geoIntersects' == this._geoComparison || | ||
'$geoWithin' == this._geoComparison)) { | ||
'$geoWithin' == this._geoComparison || | ||
'$geoIntersects' == this._geoComparison)) { | ||
throw new Error('geometry() must come after either `within()` or `intersects()`'); | ||
@@ -981,0 +990,0 @@ } |
{ | ||
"name": "mquery", | ||
"version": "0.1.3", | ||
"version": "0.2.0", | ||
"description": "Expressive query building for MongoDB", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
170550
4681