Class NearFilter


  • public class NearFilter
    extends Filter
    Defines a filter for $near and $nearSphere queries
    Since:
    2.0
    • Method Detail

      • encode

        public void encode​(Mapper mapper,
                           org.bson.BsonWriter writer,
                           org.bson.codecs.EncoderContext context)
        Overrides:
        encode in class Filter
        Parameters:
        mapper - the mapper
        writer - the writer
        context - the context
      • maxDistance

        public NearFilter maxDistance​(Double maxDistance)
        Sets the max distance to consider
        Parameters:
        maxDistance - the max
        Returns:
        this
      • minDistance

        public NearFilter minDistance​(Double minDistance)
        Sets the min distance to consider
        Parameters:
        minDistance - the min
        Returns:
        this
      • crs

        public NearFilter crs​(com.mongodb.client.model.geojson.CoordinateReferenceSystem crs)
        Sets the coordinate reference system to use
        Parameters:
        crs - the crs
        Returns:
        this
      • applyOpts

        public void applyOpts​(Map opts)
        Parameters:
        opts - the options to apply
        Developer note.
        This is an internal item. Its function and presence are subject to change without warning. Its use is highly discouraged.