Permalink
Browse files

Add array val as shorthand for Inclusion

  • Loading branch information...
1 parent cb49645 commit d8db0a47095b3525b4183b1a525b8873002f8aac mde committed Sep 9, 2012
Showing with 10 additions and 3 deletions.
  1. +10 −3 lib/query/query.js
View
@@ -111,9 +111,16 @@ Query.prototype = new (function () {
// Non-null objects
if (val && typeof val == 'object') {
- for (var p in val) {
- type = p;
- val = val[p];
+ // {id: ['foo', 'bar', 'baz']}, shorthand for Inclusion
+ if (Array.isArray(val) {
+ type = 'in';
+ }
+ // {id: {'like': 'foo'}}
+ else {
+ for (var p in val) {
+ type = p;
+ val = val[p];
+ }
}
}
else {

0 comments on commit d8db0a4

Please sign in to comment.