@@ -68,12 +68,24 @@ func TestMatch(t *testing.T) {
6868 {map [string ]interface {}{"foo" : "foo" }, false },
6969 },
7070 },
71+ {
72+ `{"foo": {"$in": ["baz"]}}` , []test {
73+ {map [string ]interface {}{"foo" : []interface {}{"baz" }}, true },
74+ {map [string ]interface {}{"foo" : []interface {}{"bar" }}, false },
75+ },
76+ },
7177 {
7278 `{"foo": {"$nin": ["bar", "baz"]}}` , []test {
7379 {map [string ]interface {}{"foo" : "bar" }, false },
7480 {map [string ]interface {}{"foo" : "foo" }, true },
7581 },
7682 },
83+ {
84+ `{"foo": {"$nin": ["baz"]}}` , []test {
85+ {map [string ]interface {}{"foo" : []interface {}{"baz" }}, false },
86+ {map [string ]interface {}{"foo" : []interface {}{"bar" }}, true },
87+ },
88+ },
7789 {
7890 `{"$or": [{"foo": "bar"}, {"bar": 1}]}` , []test {
7991 {map [string ]interface {}{"foo" : "bar" }, true },
@@ -106,6 +118,12 @@ func TestMatch(t *testing.T) {
106118 {map [string ]interface {}{"bar" : float64 (1 )}, false },
107119 },
108120 },
121+ {
122+ `{"foo.bar": "baz"}` , []test {
123+ {map [string ]interface {}{"foo" : map [string ]interface {}{"bar" : "baz" }}, true },
124+ {map [string ]interface {}{"foo" : map [string ]interface {}{"bar" : "bar" }}, false },
125+ },
126+ },
109127 }
110128 for i := range tests {
111129 tt := tests [i ]
@@ -143,6 +161,7 @@ func TestString(t *testing.T) {
143161 `{"$and": [{"foo": "bar"}, {"foo": "baz"}]}` : `{$and: [{foo: "bar"}, {foo: "baz"}]}` ,
144162 `{"foo": "bar", "$or": [{"bar": "baz"}, {"bar": "foo"}]}` : `{foo: "bar", $or: [{bar: "baz"}, {bar: "foo"}]}` ,
145163 `{"foo": ["bar", "baz"]}` : `{foo: ["bar","baz"]}` ,
164+ `{"foo.bar": "baz"}` : `{foo.bar: "baz"}` ,
146165 }
147166 for query , want := range tests {
148167 q , err := ParsePredicate (query )
0 commit comments