array query mismatch, fixes #58

This commit is contained in:
Josh Baker 2018-01-23 05:45:05 -07:00
parent 5cd723d566
commit 87033efcae
2 changed files with 8 additions and 1 deletions

View File

@ -1077,7 +1077,7 @@ func queryMatches(rp *arrayPathResult, value Result) bool {
case "=": case "=":
return value.Num == rpvn return value.Num == rpvn
case "!=": case "!=":
return value.Num == rpvn return value.Num != rpvn
case "<": case "<":
return value.Num < rpvn return value.Num < rpvn
case "<=": case "<=":

View File

@ -1288,3 +1288,10 @@ func TestIssue55(t *testing.T) {
} }
} }
} }
func TestIssue58(t *testing.T) {
json := `{"data":[{"uid": 1},{"uid": 2}]}`
res := Get(json, `data.#[uid!=1]`).Raw
if res != `{"uid": 2}` {
t.Fatalf("expected '%v', got '%v'", `{"uid": 1}`, res)
}
}