# Query parameters & clauses When querying your data, you can use your query string to get the data, then sort and manage it on the client. This topic describes a few techniques. Query examples in this content are shown unencoded to make them easier to read. Keep in mind that you might need to encode query strings if you're sending them as part of URLs, such as when you're executing them with the cURL tool.
Note
Optimizing queries. As a best practice, you should include no more than 3 parameters in your queries. The API will not prevent you from submitting a query with more than 3 parameters; however, due to the nature of NoSQL, queries with many parameters can quickly become very inefficient.
Goal | Example | Notes |
Find books whose 'title' property contains the full word "tale". | /books?ql=select * where title contains 'tale' |
containslooks for the occurrence of a full word anywhere in the searched property. Note that contains will not work on the 'name' property, since it is not full-text indexed in the database. |
Find books whose 'title' property contains a word that starts with "ta". | /books?ql=select * where title contains 'ta*' |
containswill look for partial words if you include a wildcard. |
Find books whose title property is exactly and only "A Tale of Two Cities". | /books?ql=select * where title = 'A Tale of Two Cities' |
The = operator is looking for a match in the entire searched property value. Use a * wildcard to look for some set of the first characters only. |
Goal | Example | Notes |
Find stores whose locations are within the specified longitude and latitude. | /stores?ql=location within 500 of 40.042016, -86.900749 |
within will test for values within the value you specify. The within value is expressed as a number of meters. The return results are sorted in order of nearest to furthest. If there are multiple entries at the same location, they're returned in the order they were added to the database. For more on geolocation queries, see Geolocation. |
Goal | Example | |
Sort by first name in ascending order | /users?ql=select * where lastname = 'Smith' order by firstname asc | |
Sort by first name in descending order | /users?ql=select * where lastname = 'Smith' order by firstname desc | |
Sort by last name, then first name in ascending orderl | /users?ql=select * where lastname contains 'Sm*' order by lastname asc, firstname asc |
Parameter | Type | Description |
limit | integer | Number of results to return. The maximum number of results is 1,000. Specifying a limit greater than 1,000 will result in a limit of 1,000. You can also use the limit parameter on a request without a query string. The following example is shorthand for selecting all books and limiting by 100 at a time: /books?limit=100 Using a limit on a DELETE can help you manage the amount of time it takes to delete data. For example you can delete all of the books, 1000 at a time, with the following: DELETE /books?limit=1000 Keep in mind that DELETE operations can take longer to execute. Yet even though the DELETE query call might time out (such as with a very large limit), the operation will continue on the server even if the client stops waiting for the result. |
Parameter | Type | Description |
cursor | string | An encoded representation of the query position pointing to a set of results. To retrieve the next set of results, pass the cursor with your next call for most results./td> |