Package com.mongodb

Class QueryBuilder


  • @Deprecated(since="2021-05-27")
    public class QueryBuilder
    extends java.lang.Object
    Deprecated.
    Usage of this API is not supported in AEM as a Cloud Service.
    Utility for creating DBObject queries
    • Constructor Summary

      Constructors 
      Constructor Description
      QueryBuilder()
      Deprecated.
      Creates a builder with an empty query
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      QueryBuilder all​(java.lang.Object object)
      Deprecated.
      Equivalent of the $all operand
      QueryBuilder and​(DBObject... ands)
      Deprecated.
      Equivalent to an $and operand
      QueryBuilder and​(java.lang.String key)
      Deprecated.
      Equivalent to QueryBuilder.put(key).
      QueryBuilder elemMatch​(DBObject match)
      Deprecated.
      Equivalent to the $elemMatch operand
      QueryBuilder exists​(java.lang.Object object)
      Deprecated.
      Equivalent of the $exists operand
      DBObject get()
      Deprecated.
      Creates a DBObject query to be used for the driver's find operations
      QueryBuilder greaterThan​(java.lang.Object object)
      Deprecated.
      Equivalent to the $gt operator
      QueryBuilder greaterThanEquals​(java.lang.Object object)
      Deprecated.
      Equivalent to the $gte operator
      QueryBuilder in​(java.lang.Object object)
      Deprecated.
      Equivalent of the $in operand
      QueryBuilder is​(java.lang.Object object)
      Deprecated.
      Equivalent of the find({key:value})
      QueryBuilder lessThan​(java.lang.Object object)
      Deprecated.
      Equivalent to the $lt operand
      QueryBuilder lessThanEquals​(java.lang.Object object)
      Deprecated.
      Equivalent to the $lte operand
      QueryBuilder mod​(java.lang.Object object)
      Deprecated.
      Equivalent of the $mod operand
      QueryBuilder near​(double x, double y)
      Deprecated.
      Equivalent of the $near operand
      QueryBuilder near​(double x, double y, double maxDistance)
      Deprecated.
      Equivalent of the $near operand
      QueryBuilder nearSphere​(double longitude, double latitude)
      Deprecated.
      Equivalent of the $nearSphere operand
      QueryBuilder nearSphere​(double longitude, double latitude, double maxDistance)
      Deprecated.
      Equivalent of the $nearSphere operand
      QueryBuilder not()
      Deprecated.
      Equivalent to $not meta operator.
      QueryBuilder notEquals​(java.lang.Object object)
      Deprecated.
      Equivalent of the $ne operand
      QueryBuilder notIn​(java.lang.Object object)
      Deprecated.
      Equivalent of the $nin operand
      QueryBuilder or​(DBObject... ors)
      Deprecated.
      Equivalent to an $or operand
      QueryBuilder put​(java.lang.String key)
      Deprecated.
      Adds a new key to the query if not present yet.
      QueryBuilder regex​(java.util.regex.Pattern regex)
      Deprecated.
      Passes a regular expression for a query
      QueryBuilder size​(java.lang.Object object)
      Deprecated.
      Equivalent of the $size operand
      static QueryBuilder start()
      Deprecated.
      Returns a new QueryBuilder.
      static QueryBuilder start​(java.lang.String key)
      Deprecated.
      Creates a new query with a document key
      QueryBuilder text​(java.lang.String search)
      Deprecated.
      Equivalent to a $text operand.
      QueryBuilder text​(java.lang.String search, java.lang.String language)
      Deprecated.
      Equivalent to a $text operand.
      QueryBuilder withinBox​(double x, double y, double x2, double y2)
      Deprecated.
      Equivalent to a $within operand, based on a bounding box using represented by two corners
      QueryBuilder withinCenter​(double x, double y, double radius)
      Deprecated.
      Equivalent of the $within operand, used for geospatial operation
      QueryBuilder withinCenterSphere​(double longitude, double latitude, double maxDistance)
      Deprecated.
      Equivalent of the $centerSphere operand mostly intended for queries up to a few hundred miles or km.
      QueryBuilder withinPolygon​(java.util.List<java.lang.Double[]> points)
      Deprecated.
      Equivalent to a $within operand, based on a bounding polygon represented by an array of points
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • QueryBuilder

        public QueryBuilder()
        Deprecated.
        Creates a builder with an empty query
    • Method Detail

      • start

        public static QueryBuilder start()
        Deprecated.
        Returns a new QueryBuilder.
        Returns:
        a builder
      • start

        public static QueryBuilder start​(java.lang.String key)
        Deprecated.
        Creates a new query with a document key
        Parameters:
        key - MongoDB document key
        Returns:
        this
      • put

        public QueryBuilder put​(java.lang.String key)
        Deprecated.
        Adds a new key to the query if not present yet. Sets this key as the current key.
        Parameters:
        key - MongoDB document key
        Returns:
        this
      • and

        public QueryBuilder and​(java.lang.String key)
        Deprecated.
        Equivalent to QueryBuilder.put(key). Intended for compound query chains to be more readable, e.g. QueryBuilder.start("a").greaterThan(1).and("b").lessThan(3)
        Parameters:
        key - MongoDB document key
        Returns:
        this
      • greaterThan

        public QueryBuilder greaterThan​(java.lang.Object object)
        Deprecated.
        Equivalent to the $gt operator
        Parameters:
        object - Value to query
        Returns:
        this
      • greaterThanEquals

        public QueryBuilder greaterThanEquals​(java.lang.Object object)
        Deprecated.
        Equivalent to the $gte operator
        Parameters:
        object - Value to query
        Returns:
        this
      • lessThan

        public QueryBuilder lessThan​(java.lang.Object object)
        Deprecated.
        Equivalent to the $lt operand
        Parameters:
        object - Value to query
        Returns:
        this
      • lessThanEquals

        public QueryBuilder lessThanEquals​(java.lang.Object object)
        Deprecated.
        Equivalent to the $lte operand
        Parameters:
        object - Value to query
        Returns:
        this
      • is

        public QueryBuilder is​(java.lang.Object object)
        Deprecated.
        Equivalent of the find({key:value})
        Parameters:
        object - Value to query
        Returns:
        this
      • notEquals

        public QueryBuilder notEquals​(java.lang.Object object)
        Deprecated.
        Equivalent of the $ne operand
        Parameters:
        object - Value to query
        Returns:
        this
      • in

        public QueryBuilder in​(java.lang.Object object)
        Deprecated.
        Equivalent of the $in operand
        Parameters:
        object - Value to query
        Returns:
        this
      • notIn

        public QueryBuilder notIn​(java.lang.Object object)
        Deprecated.
        Equivalent of the $nin operand
        Parameters:
        object - Value to query
        Returns:
        this
      • mod

        public QueryBuilder mod​(java.lang.Object object)
        Deprecated.
        Equivalent of the $mod operand
        Parameters:
        object - Value to query
        Returns:
        this
      • all

        public QueryBuilder all​(java.lang.Object object)
        Deprecated.
        Equivalent of the $all operand
        Parameters:
        object - Value to query
        Returns:
        this
      • size

        public QueryBuilder size​(java.lang.Object object)
        Deprecated.
        Equivalent of the $size operand
        Parameters:
        object - Value to query
        Returns:
        this
      • exists

        public QueryBuilder exists​(java.lang.Object object)
        Deprecated.
        Equivalent of the $exists operand
        Parameters:
        object - Value to query
        Returns:
        this
      • regex

        public QueryBuilder regex​(java.util.regex.Pattern regex)
        Deprecated.
        Passes a regular expression for a query
        Parameters:
        regex - Regex pattern object
        Returns:
        this
      • elemMatch

        public QueryBuilder elemMatch​(DBObject match)
        Deprecated.
        Equivalent to the $elemMatch operand
        Parameters:
        match - the object to match
        Returns:
        this
      • withinCenter

        public QueryBuilder withinCenter​(double x,
                                         double y,
                                         double radius)
        Deprecated.
        Equivalent of the $within operand, used for geospatial operation
        Parameters:
        x - x coordinate
        y - y coordinate
        radius - radius
        Returns:
        this
      • near

        public QueryBuilder near​(double x,
                                 double y)
        Deprecated.
        Equivalent of the $near operand
        Parameters:
        x - x coordinate
        y - y coordinate
        Returns:
        this
      • near

        public QueryBuilder near​(double x,
                                 double y,
                                 double maxDistance)
        Deprecated.
        Equivalent of the $near operand
        Parameters:
        x - x coordinate
        y - y coordinate
        maxDistance - max distance
        Returns:
        this
      • nearSphere

        public QueryBuilder nearSphere​(double longitude,
                                       double latitude)
        Deprecated.
        Equivalent of the $nearSphere operand
        Parameters:
        longitude - coordinate in decimal degrees
        latitude - coordinate in decimal degrees
        Returns:
        this
      • nearSphere

        public QueryBuilder nearSphere​(double longitude,
                                       double latitude,
                                       double maxDistance)
        Deprecated.
        Equivalent of the $nearSphere operand
        Parameters:
        longitude - coordinate in decimal degrees
        latitude - coordinate in decimal degrees
        maxDistance - max spherical distance
        Returns:
        this
      • withinCenterSphere

        public QueryBuilder withinCenterSphere​(double longitude,
                                               double latitude,
                                               double maxDistance)
        Deprecated.
        Equivalent of the $centerSphere operand mostly intended for queries up to a few hundred miles or km.
        Parameters:
        longitude - coordinate in decimal degrees
        latitude - coordinate in decimal degrees
        maxDistance - max spherical distance
        Returns:
        this
      • withinBox

        public QueryBuilder withinBox​(double x,
                                      double y,
                                      double x2,
                                      double y2)
        Deprecated.
        Equivalent to a $within operand, based on a bounding box using represented by two corners
        Parameters:
        x - the x coordinate of the first box corner.
        y - the y coordinate of the first box corner.
        x2 - the x coordinate of the second box corner.
        y2 - the y coordinate of the second box corner.
        Returns:
        this
      • withinPolygon

        public QueryBuilder withinPolygon​(java.util.List<java.lang.Double[]> points)
        Deprecated.
        Equivalent to a $within operand, based on a bounding polygon represented by an array of points
        Parameters:
        points - an array of Double[] defining the vertices of the search area
        Returns:
        this
      • text

        public QueryBuilder text​(java.lang.String search)
        Deprecated.
        Equivalent to a $text operand.
        Parameters:
        search - the search terms to apply to the text index.
        Returns:
        this
      • text

        public QueryBuilder text​(java.lang.String search,
                                 @Nullable
                                 java.lang.String language)
        Deprecated.
        Equivalent to a $text operand.
        Parameters:
        search - the search terms to apply to the text index.
        language - the language to use.
        Returns:
        this
      • not

        public QueryBuilder not()
        Deprecated.
        Equivalent to $not meta operator. Must be followed by an operand, not a value, e.g. QueryBuilder.start("val").not().mod(Arrays.asList(10, 1))
        Returns:
        this
      • or

        public QueryBuilder or​(DBObject... ors)
        Deprecated.
        Equivalent to an $or operand
        Parameters:
        ors - the list of conditions to or together
        Returns:
        this
      • and

        public QueryBuilder and​(DBObject... ands)
        Deprecated.
        Equivalent to an $and operand
        Parameters:
        ands - the list of conditions to and together
        Returns:
        this
      • get

        public DBObject get()
        Deprecated.
        Creates a DBObject query to be used for the driver's find operations
        Returns:
        this
        Throws:
        java.lang.RuntimeException - if a key does not have a matching operand