org.springframework.data.mongodb.core.query

Class BasicQuery



  • public class BasicQuery
    extends Query
    Custom Query implementation to setup a basic query from some arbitrary JSON query string.
    Author:
    Thomas Risberg, Oliver Gierke, Christoph Strobl, Thomas Darimont, John Willemin, Mark Paluch
    • Constructor Detail

      • BasicQuery

        public BasicQuery(@Nullable
                          String query)
        Create a new BasicQuery given a JSON query.
        Parameters:
        query - may be null.
      • BasicQuery

        public BasicQuery(org.bson.Document queryObject)
        Create a new BasicQuery given a query Document.
        Parameters:
        queryObject - must not be null.
      • BasicQuery

        public BasicQuery(org.bson.Document queryObject,
                          org.bson.Document fieldsObject)
        Create a new BasicQuery given a query Document and field specification Document.
        Parameters:
        queryObject - must not be null.
        fieldsObject - must not be null.
        Throws:
        IllegalArgumentException - when sortObject or fieldsObject is null.
    • Method Detail

      • getQueryObject

        public org.bson.Document getQueryObject()
        Overrides:
        getQueryObject in class Query
        Returns:
        the query Document.
      • getFieldsObject

        public org.bson.Document getFieldsObject()
        Overrides:
        getFieldsObject in class Query
        Returns:
        the field Document.
      • getSortObject

        public org.bson.Document getSortObject()
        Overrides:
        getSortObject in class Query
        Returns:
        the sort Document.
      • setSortObject

        public void setSortObject(org.bson.Document sortObject)
        Set the sort Document.
        Parameters:
        sortObject - must not be null.
        Throws:
        IllegalArgumentException - when sortObject is null.
      • setFieldsObject

        protected void setFieldsObject(org.bson.Document fieldsObject)
        Set the fields (projection) Document.
        Parameters:
        fieldsObject - must not be null.
        Throws:
        IllegalArgumentException - when fieldsObject is null.
        Since:
        1.6
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Query