Comparing version 0.6.8 to 0.6.9
@@ -197,3 +197,3 @@ "use strict"; | ||
// have the same implementation | ||
var methods = ["lt", "lte", "gt", "gte", "in", "nin", "and", "or", "ne", "nor"]; | ||
var methods = ["lt", "lte", "gt", "gte", "in", "nin", "ne"]; | ||
@@ -210,8 +210,12 @@ methods.forEach(function (method) { | ||
this.query[key] = (function () { | ||
var _query$key = {}; | ||
if (!value) { | ||
this.query["$" + method] = key; | ||
} else { | ||
this.query[key] = (function () { | ||
var _query$key = {}; | ||
_query$key["$" + method] = value; | ||
return _query$key; | ||
})(); | ||
_query$key["$" + method] = value; | ||
return _query$key; | ||
})(); | ||
} | ||
@@ -222,2 +226,13 @@ return this; | ||
// or, nor and and share the same imlpementation | ||
["or", "nor", "and"].forEach(function (method) { | ||
Query.prototype[method] = function () { | ||
var args = isArray(arguments[0]) ? arguments[0] : Array.from(arguments); | ||
this.query["$" + method] = args; | ||
return this; | ||
}; | ||
}); | ||
module.exports = Query; |
@@ -190,6 +190,3 @@ /** | ||
'nin', | ||
'and', | ||
'or', | ||
'ne', | ||
'nor' | ||
'ne' | ||
]; | ||
@@ -207,10 +204,25 @@ | ||
this.query[key] = { | ||
['$' + method]: value | ||
}; | ||
if (!value) { | ||
this.query['$' + method] = key; | ||
} else { | ||
this.query[key] = { | ||
['$' + method]: value | ||
}; | ||
} | ||
return this; | ||
} | ||
}; | ||
}); | ||
// or, nor and and share the same imlpementation | ||
['or', 'nor', 'and'].forEach(method => { | ||
Query.prototype[method] = function () { | ||
let args = isArray(arguments[0]) ? arguments[0] : Array.from(arguments); | ||
this.query['$' + method] = args; | ||
return this; | ||
}; | ||
}); | ||
module.exports = Query; |
{ | ||
"name": "mongorito", | ||
"version": "0.6.8", | ||
"version": "0.6.9", | ||
"description": "ES6 generator-based MongoDB ODM. It rocks.", | ||
@@ -5,0 +5,0 @@ "author": "Vadim Demedes <vdemedes@gmail.com>", |
33530
1033