Skip to content

Commit

Permalink
Fix lookup by fields beginning with numbers (broken by 2d2aaa8).
Browse files Browse the repository at this point in the history
  • Loading branch information
glasser committed Dec 28, 2012
1 parent e4befac commit 8a2328b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/minimongo/minimongo_tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -798,6 +798,7 @@ Tinytest.add("minimongo - selector_compiler", function (test) {
match({"dogs.0.name": "Fido"}, {dogs: [{name: "Fido"}, {name: "Rex"}]});
match({"dogs.1.name": "Rex"}, {dogs: [{name: "Fido"}, {name: "Rex"}]});
nomatch({"dogs.1.name": "Fido"}, {dogs: [{name: "Fido"}, {name: "Rex"}]});
match({"room.1b": "bla"}, {room: {"1b": "bla"}});

// XXX still needs tests:
// - $elemMatch
Expand Down
2 changes: 1 addition & 1 deletion packages/minimongo/selector.js
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ LocalCollection._exprForKeypathPredicate = function (keypath, value, literals) {
while (keyparts.length) {
var part = keyparts.pop();
var thisPartIsNumber = false;
if (/^\d+/.test(part)) {
if (/^\d+$/.test(part)) {
part = +part;
thisPartIsNumber = true;
}
Expand Down

0 comments on commit 8a2328b

Please sign in to comment.