Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mquery

Package Overview
Dependencies
Maintainers
2
Versions
74
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mquery - npm Package Compare versions

Comparing version 0.1.2 to 0.1.3

mqTest.js

31

lib/mquery.js

@@ -69,2 +69,11 @@ '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.
*
*/
Query.use$geoWithin = false;
/**
* Converts this query to a constructor function with all arguments and options retained.

@@ -178,2 +187,3 @@ *

this._collection = new Query.Collection(coll);
return this;

@@ -236,2 +246,3 @@ }

if (!arguments.length) return this;
if (!this.op) this.op = 'find';

@@ -669,3 +680,7 @@ var type = typeof arguments[0];

this._geoComparison = '$within';
if (Query.use$geoWithin) {
this._geoComparison = '$geoWithin';
} else {
this._geoComparison = '$within';
}

@@ -738,3 +753,3 @@ if (0 === arguments.length) {

var conds = this._conditions[path] || (this._conditions[path] = {});
conds.$within = { '$box': box };
conds[this._geoComparison || "$within"] = { '$box': box };
return this;

@@ -773,3 +788,3 @@ }

var conds = this._conditions[path] || (this._conditions[path] = {});
conds['$within'] = { '$polygon': val };
conds[this._geoComparison || "$within"] = { '$polygon': val };
return this;

@@ -822,7 +837,8 @@ }

conds.$within = {};
conds.$within[type] = [val.center, val.radius];
var wKey = this._geoComparison || "$within";
conds[wKey] = {};
conds[wKey][type] = [val.center, val.radius];
if ('unique' in val)
conds.$within.$uniqueDocs = !! val.unique;
conds[wKey].$uniqueDocs = !! val.unique;

@@ -963,3 +979,4 @@ return this;

if (!('$within' == this._geoComparison ||
'$geoIntersects' == this._geoComparison)) {
'$geoIntersects' == this._geoComparison ||
'$geoWithin' == this._geoComparison)) {
throw new Error('geometry() must come after either `within()` or `intersects()`');

@@ -966,0 +983,0 @@ }

{
"name": "mquery",
"version": "0.1.2",
"version": "0.1.3",
"description": "Expressive query building for MongoDB",

@@ -5,0 +5,0 @@ "main": "index.js",

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc