public static Bson geoWithinPolygon(final String fieldName, final List<List<Double>> points) {
        BsonArray pointsArray = new BsonArray();
        for (List<Double> point : points) {
            pointsArray.add(new BsonArray(asList(new BsonDouble(point.get(0)), new BsonDouble(point.get(1)))));
        }
        BsonDocument polygon = new BsonDocument("$polygon", pointsArray);
        return new OperatorFilter<BsonDocument>("$geoWithin", fieldName, polygon);
    }
public static Bson geoWithinPolygon(final String fieldName, final List<List<Double>> points) {
        BsonArray pointsArray = new BsonArray();
        for (List<Double> point : points) {
            pointsArray.add(new BsonArray(asList(new BsonDouble(point.get(0)), new BsonDouble(point.get(1)))));
        }
        BsonDocument polygon = new BsonDocument("$polygon", pointsArray);
        return new OperatorFilter<BsonDocument>("$geoWithin", fieldName, polygon);
    }
public static Bson geoWithinPolygon ( final String fieldName , final List < List < Double > > points ) { BsonArray pointsArray = new BsonArray ( ) ; for ( List < Double > point : points ) { pointsArray . add ( new BsonArray ( asList ( new BsonDouble ( point . get ( 0 ) ) , new BsonDouble ( point . get ( 1 ) ) ) ) ) ; } BsonDocument polygon = new BsonDocument ( "$polygon" , pointsArray ) ; return new OperatorFilter < BsonDocument > ( "$geoWithin" , fieldName , polygon ) ; }
Creates a filter that matches all documents containing a field with grid coordinates data that exist entirely within the specified
polygon.

@param fieldName the field name
@param points    a list of pairs of x, y coordinates.  Any extra dimensions are ignored
@return the filter
@mongodb.driver.manual reference/operator/query/geoWithin/ $geoWithin
@mongodb.driver.manual reference/operator/query/polygon/#op._S_polygon $polygon
@mongodb.server.release 2.4
@since 3.1
Creates a filter that matches all documents containing a field with grid coordinates data that exist entirely within the specified polygon .