    @Test
    void testMatchesSize() throws Exception {


        Document query = map("a", size(1));

        assertThat(matcher.matches(json(""), query)).isFalse();
        assertThat(matcher.matches(json("a: 'x'"), query)).isFalse();
        assertThat(matcher.matches(map("a", list()), query)).isFalse();
        assertThat(matcher.matches(map("a", list(1)), query)).isTrue();
        assertThat(matcher.matches(map("a", list(1, 2)), query)).isFalse();

        assertThatExceptionOfType(MongoServerError.class)
            .isThrownBy(() -> matcher.matches(json(""), json("a: {$size: {$gt: 0}}")))
            .withMessage("[Error 2] $size needs a number");
    }