---
title: Query Cookbook
slug: docs/android/data-objects/query-cookbook
description: In this guide, you'll learn how to use every query method in Parse on a Android application
image: https://www.back4app.com/images/logo-social.png
docTags: 
createdAt: 2024-03-13T14:26:57.257Z
---

# Parse Query Cookbook in Android

## Introduction

We’ve already seen how a <font color="#2166ae">`ParseQuery`</font> with <font color="#2166ae">`get`</font> can retrieve a single <font color="#2166ae">`ParseQuery`</font> from Back4App. There are many other ways to retrieve data with<font color="#2166ae">`ParseQuery`</font>you can retrieve many objects at once, use conditions on the objects you wish to retrieve, and more.

In this guide, you will ding deep into the <font color="#2166ae">`ParseQuery`</font> class and see all the methods you can use to build your Queries. You will use a simple database class with some mocked data to perform the Queries using the Javascript Console on Back4App.

:::hint{type="info"}
You can use Javascript Console on Back4App to create mocked data easily, or you can create your data with your own android app by following [this guide](https://www.back4app.com/docs/android/data-objects/android-crud-tutorial).
:::

This tutorial uses an app created in Android Studio 4.1.1 with <font color="#2166ae">`buildToolsVersion=30.0.2`</font> , <font color="#2166ae">`Compile SDK Version = 30.0.2`</font> and <font color="#2166ae">`targetSdkVersion=30`</font>

:::hint{type="success"}
At any time, you can access the complete Android Project built with this tutorial at our Github repositories

- [Kotlin Example Repository](https://github.com/templates-back4app/Android-Parse-Sdk-Kotlin)
- [Java Example Repository](https://github.com/templates-back4app/Android-Parse-Sdk-Java)
:::

## Prerequisites

:::hint{type="info"}
**To complete this tutorial, we need:**

- [Android Studio](https://developer.android.com/studio/index.html)
- An app created on Back4App.
  - **Note:&#x20;**&#x46;ollow the [New Parse App tutorial](https://www.back4app.com/docs/get-started/new-parse-app) to learn how to create a Parse App on Back4App.
- An android app connected to Back4App.
  - **Note:&#x20;**&#x46;ollow the [Install Parse SDK tutoria](https://www.back4app.com/docs/android/parse-android-sdk)l to create an Android Studio Project connected to Back4App.
- A device (or[ virtual device](https://developer.android.com/studio/run/managing-avds.html)) running Android 4.1 (Jelly Bean) or newer.
:::

## Goal

Explore the <font color="#2166ae">`ParseQuery`</font> class different methods and learn query types you can create on Android.

## The ParseQuery class

Any query operation on Parse uses the <font color="#2166ae">`ParseQuery`</font> object type, which will help you retrieve specific data from your Back4App throughout your app. To create a new <font color="#2166ae">`ParseQuery`</font>, you need to pass as a parameter the desired <font color="#2166ae">`ParseQuery`</font> subclass, which is the one that will contain your query results.

It is crucial to know that a <font color="#2166ae">`ParseQuery`</font> will only resolve after calling a retrieve method (like <font color="#2166ae">`ParseQuery.find`</font> or <font color="#2166ae">`ParseQuery.get`</font>), so a query can be set up and several modifiers can be chained before actually being called.

You can read more about the <font color="#2166ae">`ParseQuery` </font>class [here at the official documentation](https://parseplatform.org/Parse-SDK-Android/api/).

## Using the JS Console on Back4App

Inside your Back4App application’s dashboard, you will find a very useful API console in which you can run JavaScript code directly. In this guide you will use to store and query data objects from Back4App. On your App main dashboard go to <font color="#2166ae">`Core->API Console->JS Console.`</font>



![](https://api.archbee.com/api/optimize/yD3zCY-NNBBIfd0uqcfR5/VmgZDeOUXd-46heXu9bWb_image.png)

## Save your Data Objects

To run the queries on this guide you’ll need first to populate your App with some data. Let’s create a sample class called <font color="#2166ae">`Profile`</font>, which mocks a social media profile class using famous people names and the following fields:

- string type
- Date type
- Number (integer) type
- Array (string array) type
- Array (Number array) type
- GeoPoint type
- Nullable pointer type

Here is the <font color="#2166ae">`Parse.Object`</font> classes creation code, so go ahead and run it in your API console:

```java
1   // Add Profile objects and create table
2   // Adam Sandler
3   let Profile = new Parse.Object('Profile');
4   Profile.set('name', 'Adam Sandler');
5   Profile.set('birthDay', new Date('09/09/1966'));
6   Profile.set('friendCount', 2);
7   Profile.set('favoriteFoods', ['Lobster', 'Bread']);
8   Profile.set('luckyNumbers', [2, 7]);
9   Profile.set('lastLoginLocation', new Parse.GeoPoint(37.38412167489413, -122.01268034622319));
10  await Profile.save();
11
12  // Britney Spears
13  Profile = new Parse.Object('Profile');
14  Profile.set('name', 'Britney Spears');
15  Profile.set('birthDay', new Date('12/02/1981'));
16  Profile.set('friendCount', 52);
17  Profile.set('favoriteFoods', ['Cake', 'Bread']);
18  Profile.set('luckyNumbers', [22, 7]);
19  Profile.set('lastLoginLocation', new Parse.GeoPoint(37.38412167489413, -122.01268034622319));
20  await Profile.save();
21
22  // Carson Kressley
23  Profile = new Parse.Object('Profile');
24  Profile.set('name', 'Carson Kressley');
25  Profile.set('birthDay', new Date('11/11/1969'));
26  Profile.set('friendCount', 12);
27  Profile.set('favoriteFoods', ['Fish', 'Cookies']);
28  Profile.set('luckyNumbers', [8, 2]);
29  Profile.set('lastLoginLocation', new Parse.GeoPoint(37.38412167489413, -122.01268034622319));
30  await Profile.save();
31
32  // Dan Aykroyd
33  // Creates related object Membership for this user only
34  let Membership = new Parse.Object('Membership');
35  Membership.set('name', 'Premium');
36  Membership.set('expirationDate', new Date('10/10/2030'))
37  await Membership.save();
38  Profile = new Parse.Object('Profile');
39  Profile.set('name', 'Dan Aykroyd');
40  Profile.set('birthDay', new Date('07/01/1952'));
41  Profile.set('friendCount', 66);
42  Profile.set('favoriteFoods', ['Jam', 'Peanut Butter']);
43  Profile.set('luckyNumbers', [22, 77]);
44  Profile.set('lastLoginLocation', new Parse.GeoPoint(37.38412167489413, -122.01268034622319));
45  Profile.set('premiumMembership', Membership);
46  await Profile.save();
47
48  // Eddie Murphy
49  Profile = new Parse.Object('Profile');
50  Profile.set('name', 'Eddie Murphy');
51  Profile.set('birthDay', new Date('04/03/1961'));
52  Profile.set('friendCount', 49);
53  Profile.set('favoriteFoods', ['Lettuce', 'Pepper']);
54  Profile.set('luckyNumbers', [6, 5]);
55  Profile.set('lastLoginLocation', new Parse.GeoPoint(-27.104919974838154, -52.61428045237739));
56  await Profile.save();
57  
58  // Fergie
59  Profile = new Parse.Object('Profile');
60  Profile.set('name', 'Fergie');
61  Profile.set('birthDay', new Date('03/27/1975'));
62  Profile.set('friendCount', 55);
63  Profile.set('favoriteFoods', ['Lobster', 'Shrimp']);
64  Profile.set('luckyNumbers', [13, 7]);
65  Profile.set('lastLoginLocation', new Parse.GeoPoint(-27.104919974838154, -52.61428045237739));
66  await Profile.save();
67
68  console.log('Success!');
```

After running this code, you should now have a <font color="#2166ae">`Profile`</font> class in your database with six objects created. Your new class should look like this:

![](https://api.archbee.com/api/optimize/yD3zCY-NNBBIfd0uqcfR5/AS_KAw59PrxFqVPELsUp2_image.png)

Let’s now take a look at examples from every <font color="#2166ae">`ParseQuery`</font> method, along with brief explanations on what they do. Please note that some methods in this list can take <font color="#2166ae">`options`</font> as an additional argument, but in most cases, it is only related to <font color="#2166ae">`masterKey`</font> usage and not relevant to this guide content, so this possibility will be omitted whenever not relevant.

## Query retrievers

These methods are responsible for running the query and retrieving its results, being always present in your query implementation.

This is the **java** methods:

:::CodeblockTabs
cancel

```java
//Cancels the current network request.
1   ParseQuery<ParseObject> query = new ParseQuery<>("Profile");
2   query.findInBackground();
3   query.cancel();
```

count

```java
//Retrieves the count of ParseObject results that meet the query criteria.
1     ParseQuery<ParseObject> query = new ParseQuery<>("Profile");
2     try {
3         int queryCount = query.count();
4         Log.d(TAG, "Count: " + queryCount);
5     } catch (com.parse.ParseException parseException) {
6         parseException.printStackTrace();
7     }
```

find

```java
//This is the basic method for retrieving your query results, always returning an array of ParseObject instances, being empty when none are found.
1   //This find function works synchronously.
2     ParseQuery<ParseObject> query = new ParseQuery<>("Profile");
3     try {
4         List<ParseObject> list = query.find();
5         Log.d(TAG, "List: " + list);
6     } catch (com.parse.ParseException e) {
7         e.printStackTrace();
8     }
```

findInBackground

```java
//This is the basic method for retrieving your query results, always returning an array of ParseObject instances, being empty when none are found.
1   //This find function works asynchronously.
2     ParseQuery<ParseObject> query = new ParseQuery<>("Profile");
3     query.findInBackground((objects, e) -> {
4         if (e == null) {
5             Log.d(TAG, "Objects: " + objects);
6         } else {
7             Log.e(TAG, "ParseError: ", e);
8         }
9     });
```

first

```java
//Retrieves the first ParseObject instance that meets the query criteria.
1     ParseQuery<ParseObject> query = new ParseQuery<>("Profile");
2     try {
3         ParseObject firstItem = query.getFirst();
4         Log.d(TAG, "First Item: " + firstItem);
5     } catch (ParseException e) {
6         e.printStackTrace();
7     }
```

get

```java
//This quick method is used to retrieve a single ParseObject instance when you know its objectId.
1   //We can call a parse object with an object id with the get() function.
2     ParseQuery<ParseObject> query = new ParseQuery<>("Profile");
3     try {
4         ParseObject object = query.get("C6ENdLnFdQ");
5         Log.d(TAG, "Object: " + object);
6     } catch (ParseException e) {
7         e.printStackTrace();
8     }
```
:::

This is the **kotlin** methods:

:::CodeblockTabs
cancel

```kotlin
//Cancels the current network request.
1   val query = ParseQuery<ParseObject>("Profile")
2   query.findInBackground()
3   query.cancel()
```

count

```kotlin
//Retrieves the count of ParseObject results that meet the query criteria.
1     val query = ParseQuery<ParseObject>("Profile")
2     try {
3         val queryCount = query.count()
4         Log.d(Companion.TAG, "Count: $queryCount")
5     } catch (parseException: ParseException) {
6         parseException.printStackTrace()
7     }
```

find

```kotlin
//This is the basic method for retrieving your query results, always returning an array of ParseObject instances, being empty when none are found.
1   //This find function works synchronously.
2     val query = ParseQuery<ParseObject>("Profile")
3     try {
4         val list = query.find()
5         Log.d(Companion.TAG, "List: $list")
6     } catch (e: ParseException) {
7         e.printStackTrace()
8     }
```

findInBackground

```kotlin
//This is the basic method for retrieving your query results, always returning an array of ParseObject instances, being empty when none are found.
1   //This find function works asynchronously.
2     val query = ParseQuery<ParseObject>("Profile")
3     query.findInBackground { objects: List<ParseObject>, e: ParseException? ->
4         if (e == null) {
5             Log.d(Companion.TAG, "Objects: $objects")
6         } else {
7             Log.e(Companion.TAG, "ParseError: ", e)
8         }
9     }
```

first

```kotlin
//Retrieves the first ParseObject instance that meets the query criteria.
1     val query = ParseQuery<ParseObject>("Profile")
2     try {
3         val firstItem = query.first
4         Log.d(Companion.TAG, "First Item: $firstItem")
5     } catch (e: ParseException) {
6         e.printStackTrace()
7     }
```

get

```kotlin
//This quick method is used to retrieve a single ParseObject instance when you know its objectId.
1   //We can call a parse object with an object id with the get() function.
2     val query = ParseQuery<ParseObject>("Profile")
3     try {
4         val `object` = query["C6ENdLnFdQ"]
5         Log.d(Companion.TAG, "Object: $`object`")
6     } catch (e: ParseException) {
7         e.printStackTrace()
8     }
```
:::

## Query conditioners

These methods give you the possibility of applying conditional constraints to your query, which are arguably the most important operations in querying. Remember that these operations can all be chained before the results are retrieved, so many combinations can be achieved to solve your querying needs.

These are **Java** methods

:::CodeblockTabs
containedIn

```java
//Filters objects in which a key value is contained in the provided array of values.
1     ParseQuery<ParseObject> query = new ParseQuery<>("Profile");
2     query.whereContainedIn("luckyNumbers", List.of(2, 7));
3     query.findInBackground((objects, e) -> {
4         if (e == null) {
5             Log.d(TAG, "Objects: " + objects);
6         } else {
7             Log.e(TAG, "Parse Error: ", e);
8         }
9
10    });
```

contains

```java
//Filters objects in which a string key value contains the provided text value. Be aware that this condition is case-sensitive.
1     ParseQuery<ParseObject> query = new ParseQuery<>("Profile");
2     query.whereContains("name", "da");
3     query.findInBackground((objects, e) -> {
4         if (e == null) {
5             Log.d(TAG, "Objects: " + objects);
6         } else {
7             Log.e(TAG, "Parse Error: ", e);
8         }
9
10    });
```

cointansAll

```java
//Filters objects in which an array type key value must contain every value provided.
1     ParseQuery<ParseObject> query = new ParseQuery<>("Profile");
2     query.whereContainsAll("luckyNumbers", List.of(2, 7));
3     query.findInBackground((objects, e) -> {
4         if (e == null) {
5             Log.d(TAG, "Objects: " + objects);
6         } else {
7             Log.e(TAG, "Parse Error: ", e);
8         }
9
10    });
```

containsAllStartingWith

```java
//Filters objects in which an array type key value must contain every string value provided.
1     ParseQuery<ParseObject> query = new ParseQuery<>("Profile");
2     query.whereContainsAllStartsWith("favoriteFoods", List.of("Shrimp", "Lobster"));
3     query.findInBackground((objects, e) -> {
4         if (e == null) {
5             Log.d(TAG, "Objects: " + objects);
6         } else {
7             Log.e(TAG, "Parse Error: ", e);
8         }
9
10    });
```

doesNotExist

```java
//Filters objects in which a key value is not set.
1     ParseQuery<ParseObject> query = new ParseQuery<>("Profile");
2     query.whereDoesNotExist("premiumMembership");
3     query.findInBackground((objects, e) -> {
4         if (e == null) {
5             Log.d(TAG, "Objects: " + objects);
6        } else {
7            Log.e(TAG, "Parse Error: ", e);
8        }
9    });
```
:::

These are **Kotlin** methods

:::CodeblockTabs
containedIn

```kotlin
//Filters objects in which a key value is contained in the provided array of values.
1     val query = ParseQuery<ParseObject>("Profile")
2     query.whereContainedIn("luckyNumbers", java.util.List.of(2, 7))
3     query.findInBackground { objects: List<ParseObject>, e: ParseException? ->
4         if (e == null) {
5             Log.d(Companion.TAG, "Objects: $objects")
6         } else {
7             Log.e(Companion.TAG, "Parse Error: ", e)
8         }
9     }
```

contains

```kotlin
//Filters objects in which a string key value contains the provided text value. Be aware that this condition is case-sensitive.
1     val query = ParseQuery<ParseObject>("Profile")
2     query.whereContains("name", "da")
3     query.findInBackground { objects: List<ParseObject>, e: ParseException? ->
4         if (e == null) {
5             Log.d(Companion.TAG, "Objects: $objects")
6         } else {
7             Log.e(Companion.TAG, "Parse Error: ", e)
8         }
9     }
```

cointansAll

```kotlin
//Filters objects in which an array type key value must contain every value provided.
1     val query = ParseQuery<ParseObject>("Profile")
2     query.whereContainsAll("luckyNumbers", java.util.List.of(2, 7))
3     query.findInBackground { objects: List<ParseObject>, e: ParseException? ->
4         if (e == null) {
5             Log.d(Companion.TAG, "Objects: $objects")
6         } else {
7             Log.e(Companion.TAG, "Parse Error: ", e)
8         }
9     }
```

containsAllStartingWith

```kotlin
//Filters objects in which an array type key value must contain every string value provided.
1     val query = ParseQuery<ParseObject>("Profile")
2     query.whereContainsAllStartsWith("favoriteFoods", java.util.List.of("Shrimp", "Lobster"))
3     query.findInBackground { objects: List<ParseObject>, e: ParseException? ->
4         if (e == null) {
5             Log.d(Companion.TAG, "Objects: $objects")
6         } else {
7             Log.e(Companion.TAG, "Parse Error: ", e)
8         }
9     }
```

doesNotExist

```kotlin
//Filters objects in which a key value is not set.
1     val query = ParseQuery<ParseObject>("Profile")
2     query.whereDoesNotExist("premiumMembership")
3     query.findInBackground { objects: List<ParseObject>, e: ParseException? ->
4         if (e == null) {
5             Log.d(Companion.TAG, "Objects: $objects")
6         } else {
7             Log.e(Companion.TAG, "Parse Error: ", e)
8         }
9     }
```
:::

These are **Java** methods

:::CodeblockTabs
canceldoesNotMatchKeyInQuery

```java
//Requires that a key’s value does not match a value in an object returned by a different ParseQuery. Useful for multi-object querying.
1   ParseQuery<ParseObject> query = new ParseQuery<>("Profile");
2   ParseQuery<ParseObject> innerQuery = new ParseQuery<>("Profile");
3   innerQuery.whereLessThan("friendCount", 50);
4   query.whereDoesNotMatchKeyInQuery("friendCount", "friendCount", innerQuery);
5   query.whereGreaterThan("friendCount", 10);
6   query.findInBackground((objects, e) -> {
7       if (e == null) {
8           Log.d(TAG, "Objects: " + objects);
9       } else {
10          Log.e(TAG, "Parse Error: ", e);
11      }
12  });
```

doesNotMatchQuery

```java
//Requires that an object contained in the given key does not match another query. Useful for multi-object querying.
1   ParseQuery<ParseObject> query = new ParseQuery<>("Profile");
2   ParseQuery<ParseObject> innerQuery = new ParseQuery<>("Membership");
3   innerQuery.whereGreaterThan("expirationDate", new Date());
4   query.whereExists("premiumMembership");
5   query.whereDoesNotMatchQuery("premiumMembership", innerQuery);
6   query.findInBackground((objects, e) -> {
7       if (e == null) {
8           Log.d(TAG, "Objects: " + objects);
9       } else {
10          Log.e(TAG, "Parse Error: ", e);
11      }
12  });
```

endsWith

```java
//Filters objects in which a string key’s value ends with the provided text value.
1   ParseQuery<ParseObject> query = new ParseQuery<>("Profile");
2   query.whereEndsWith("name", "ie");
3   query.findInBackground((objects, e) -> {
4       if (e == null) {
5           Log.d(TAG, "Objects: " + objects);
6       } else {
7           Log.e(TAG, "Parse Error: ", e);
8       }
9   });
```

equalTo

```java
//Filters objects in which a specific key’s value is equal to the provided value.
1   ParseQuery<ParseObject> query = new ParseQuery<>("Profile");
2   query.whereEqualTo("friendCount", 2);
3   query.findInBackground((objects, e) -> {
4       if (e == null) {
5           Log.d(TAG, "Objects: " + objects);
6       } else {
7           Log.e(TAG, "Parse Error: ", e);
8       }
9   });
```
:::

:::CodeblockTabs
exists

```java
//Filters objects in which a key value is set.
1   ParseQuery<ParseObject> query = new ParseQuery<>("Profile");
2   query.whereExists("premiumMembership");
3   query.findInBackground((objects, e) -> {
4       if (e == null) {
5           Log.d(TAG, "Objects: " + objects);
6       } else {
7           Log.e(TAG, "Parse Error: ", e);
8       }
9   });
```

fullText

```java
//Filters objects in which a string key’s value wrap matches the provided text value in it. It can have many customizable options to improve its results, like language specification and score order.
1   ParseQuery<ParseObject> query = new ParseQuery<>("Profile");
2   query.whereFullText("name", "Spears");
3   query.findInBackground((objects, e) -> {
4       if (e == null) {
5           Log.d(TAG, "Objects: " + objects);
6       } else {
7           Log.e(TAG, "Parse Error: ", e);
8       }
9   });
```

greaterThan

```java
//Filters objects in which a specific key’s value is greater than the provided value.
1   ParseQuery<ParseObject> query = new ParseQuery<>("Profile");
2   Calendar calendar = Calendar.getInstance();
3   calendar.set(1980, 8, 19, 59, 59, 59);
4   Date date = calendar.getTime();
5   query.whereGreaterThan("birthDay", date);
6   query.findInBackground((objects, e) -> {
7       if (e == null) {
8           Log.d(TAG, "Objects: " + objects);
9       } else {
10          Log.e(TAG, "Parse Error: ", e);
11      }
12  });
```

greaterThanOrEqualTo

```java
//Filters objects in which a specific key’s value is greater than or equal to the provided value.
1   ParseQuery<ParseObject> query = new ParseQuery<>("Profile");
2   query.whereGreaterThanOrEqualTo("friendCount", 49);
3   query.findInBackground((objects, e) -> {
4       if (e == null) {
5           Log.d(TAG, "Objects: " + objects);
6       } else {
7           Log.e(TAG, "Parse Error: ", e);
8       }
9  });
```
:::

These are **Kotlin** methods

:::CodeblockTabs
canceldoesNotMatchKeyInQuery

```java
//Requires that a key’s value does not match a value in an object returned by a different ParseQuery. Useful for multi-object querying.
1   val query = ParseQuery<ParseObject>("Profile")
2   val innerQuery = ParseQuery<ParseObject>("Profile")
3   innerQuery.whereLessThan("friendCount", 50)
4   query.whereDoesNotMatchKeyInQuery("friendCount", "friendCount", innerQuery)
5   query.whereGreaterThan("friendCount", 10)
6   query.findInBackground { objects: List<ParseObject>, e: ParseException? ->
7       if (e == null) {
8           Log.d(Companion.TAG, "Objects: $objects")
9       } else {
10          Log.e(Companion.TAG, "Parse Error: ", e)
11      }
12  }
```

doesNotMatchQuery

```java
//Requires that an object contained in the given key does not match another query. Useful for multi-object querying.
1   val query = ParseQuery<ParseObject>("Profile")
2   val innerQuery = ParseQuery<ParseObject>("Membership")
3   innerQuery.whereGreaterThan("expirationDate", Date())
4   query.whereExists("premiumMembership")
5   query.whereDoesNotMatchQuery("premiumMembership", innerQuery)
6   query.findInBackground { objects: List<ParseObject>, e: ParseException? ->
7       if (e == null) {
8           Log.d(Companion.TAG, "Objects: $objects")
9       } else {
10          Log.e(Companion.TAG, "Parse Error: ", e)
11      }
12  }
```

endsWith

```java
//Filters objects in which a string key’s value ends with the provided text value.
1   val query = ParseQuery<ParseObject>("Profile")
2   query.whereEndsWith("name", "ie")
3   query.findInBackground { objects: List<ParseObject>, e: ParseException? ->
4       if (e == null) {
5           Log.d(Companion.TAG, "Objects: $objects")
6       } else {
7           Log.e(Companion.TAG, "Parse Error: ", e)
8       }
9   }
```

equalTo

```java
//Filters objects in which a specific key’s value is equal to the provided value.
1   val query = ParseQuery<ParseObject>("Profile")
2   query.whereEqualTo("friendCount", 2)
3   query.findInBackground { objects: List<ParseObject>, e: ParseException? ->
4       if (e == null) {
5           Log.d(Companion.TAG, "Objects: $objects")
6       } else {
7           Log.e(Companion.TAG, "Parse Error: ", e)
8       }
9   }
```
:::

:::CodeblockTabs
exists

```java
//Filters objects in which a key value is set.
1   val query = ParseQuery<ParseObject>("Profile")
2   query.whereExists("premiumMembership")
3   query.findInBackground { objects: List<ParseObject>, e: ParseException? ->
4       if (e == null) {
5           Log.d(Companion.TAG, "Objects: $objects")
6       } else {
7           Log.e(Companion.TAG, "Parse Error: ", e)
8       }
9   }
```

fullText

```java
//Filters objects in which a string key’s value wrap matches the provided text value in it. It can have many customizable options to improve its results, like language specification and score order.
1   val query = ParseQuery<ParseObject>("Profile")
2   query.whereFullText("name", "Spears")
3   query.findInBackground { objects: List<ParseObject>, e: ParseException? ->
4       if (e == null) {
5           Log.d(Companion.TAG, "Objects: $objects")
6       } else {
7           Log.e(Companion.TAG, "Parse Error: ", e)
8       }
9   }
```

greaterThan

```java
//Filters objects in which a specific key’s value is greater than the provided value.
1   val query = ParseQuery<ParseObject>("Profile")
2   val calendar = Calendar.getInstance()
3   calendar[1980, 8, 19, 59, 59] = 59
4   val date = calendar.time
5   query.whereGreaterThan("birthDay", date)
6   query.findInBackground { objects: List<ParseObject>, e: ParseException? ->
7       if (e == null) {
8           Log.d(Companion.TAG, "Objects: $objects")
9       } else {
10          Log.e(Companion.TAG, "Parse Error: ", e)
11      }
12  }
```

greaterThanOrEqualTo

```java
//Filters objects in which a specific key’s value is greater than or equal to the provided value.
1   val query = ParseQuery<ParseObject>("Profile")
2   query.whereGreaterThanOrEqualTo("friendCount", 49)
3   query.findInBackground { objects: List<ParseObject>, e: ParseException? ->
4       if (e == null) {
5           Log.d(Companion.TAG, "Objects: $objects")
6       } else {
7           Log.e(Companion.TAG, "Parse Error: ", e)
8       }
9   }
```
:::

These are **Java** methods

:::CodeblockTabs
lessThan

```java
//Filters objects in which a specific key’s value is lesser than the provided value.
1   ParseQuery<ParseObject> query = new ParseQuery<>("Profile");
2   Calendar calendar = Calendar.getInstance();
3   calendar.set(1980, 8, 19, 59, 59, 59);
4   Date date = calendar.getTime();
5   query.whereLessThan("birthDay", date);
6   query.findInBackground((objects, e) -> {
7       if (e == null) {
8           Log.d(TAG, "Objects: " + objects);
9       } else {
10          Log.e(TAG, "Parse Error: ", e);
11      }
12  });
```

lessThanOrEqualTo

```java
//Filters objects in which a specific key’s value is lesser than or equal to the provided value.
1   ParseQuery<ParseObject> query = new ParseQuery<>("Profile");
2   query.whereLessThanOrEqualTo("friendCount", 49);
3   query.findInBackground((objects, e) -> {
4       if (e == null) {
5           Log.d(TAG, "Objects: " + objects);
6       } else {
7           Log.e(TAG, "Parse Error: ", e);
8       }
9   });
```

matches

```java
//Filters objects in which a string type key value must match the provided regular expression and its modifiers.
1   ParseQuery<ParseObject> query = new ParseQuery<>("Profile");
2   query.whereMatches("name", "da", "i");
3   query.findInBackground((objects, e) -> {
4       if (e == null) {
5           Log.d(TAG, "Objects: " + objects);
6       } else {
7           Log.e(TAG, "Parse Error: ", e);
8       }
9   });
```

matchesKeyInQuery

```java
//Requires that a key’s value matches a value in an object returned by a different ParseQuery. Useful for multi-object querying.1   ParseQuery<ParseObject> query = new ParseQuery<>("Profile");
1   ParseQuery<ParseObject> query = new ParseQuery<>("Profile");
2   ParseQuery<ParseObject> innerQuery = new ParseQuery<>("Profile");
3   innerQuery.whereLessThan("friendCount", 50);
4   query.whereMatchesKeyInQuery("friendCount", "friendCount", innerQuery);
5   query.whereGreaterThan("friendCount", 10);
6   query.findInBackground((objects, e) -> {
7       if (e == null) {
8           Log.d(TAG, "Objects: " + objects);
9       } else {
10           Log.e(TAG, "Parse Error: ", e);
11      }
12  });
```

matchesQuery

```java
//Requires that an object contained in the given key matches another query. Useful for multi-object querying.
1   ParseQuery<ParseObject> query = new ParseQuery<>("Profile");
2   ParseQuery<ParseObject> innerQuery = new ParseQuery<>("Membership");
3   innerQuery.whereGreaterThan("expirationDate", new Date());
4   query.whereExists("premiumMembership");
5   query.whereMatchesQuery("premiumMembership", innerQuery);
6   query.findInBackground((objects, e) -> {
7       if (e == null) {
8           Log.d(TAG, "Objects: " + objects);
9       } else {
10          Log.e(TAG, "Parse Error: ", e);
11      }
12  });
```

notEqualTo

```java
//Filters objects in which a specific key’s value is not equal to the provided value.
1   ParseQuery<ParseObject> query = new ParseQuery<>("Profile");
2   query.whereNotEqualTo("friendCount", 2);
3   query.findInBackground((objects, e) -> {
4       if (e == null) {
5           Log.d(TAG, "Objects: " + objects);
6       } else {
7           Log.e(TAG, "Parse Error: ", e);
8       }
9   });
```

startsWith

```java
//Filters objects in which a string key’s value starts with the provided text value.
1   ParseQuery<ParseObject> query = new ParseQuery<>("Profile");
2   query.whereStartsWith("name", "Brit");
3   query.findInBackground((objects, e) -> {
4       if (e == null) {
5           Log.d(TAG, "Objects: " + objects);
6       } else {
7           Log.e(TAG, "Parse Error: ", e);
8       }
9   });
```
:::

These are **Kotlin** methods

:::CodeblockTabs
lessThan

```kotlin
//Filters objects in which a specific key’s value is lesser than the provided value.
1   val query = ParseQuery<ParseObject>("Profile")
2   val calendar = Calendar.getInstance()
3   calendar[1980, 8, 19, 59, 59] = 59
4   val date = calendar.time
5   query.whereLessThan("birthDay", date)
6   query.findInBackground { objects: List<ParseObject>, e: ParseException? ->
7       if (e == null) {
8           Log.d(Companion.TAG, "Objects: $objects")
9       } else {
10          Log.e(Companion.TAG, "Parse Error: ", e)
11      }
12  }
```

lessThanOrEqualTo

```kotlin
//Filters objects in which a specific key’s value is lesser than or equal to the provided value.
1   val query = ParseQuery<ParseObject>("Profile")
2   query.whereLessThanOrEqualTo("friendCount", 49)
3   query.findInBackground { objects: List<ParseObject>, e: ParseException? ->
4       if (e == null) {
5           Log.d(Companion.TAG, "Objects: $objects")
6       } else {
7           Log.e(Companion.TAG, "Parse Error: ", e)
8       }
9   }
```

matches

```kotlin
//Filters objects in which a string type key value must match the provided regular expression and its modifiers.
1   val query = ParseQuery<ParseObject>("Profile")
2   query.whereMatches("name", "da", "i")
3   query.findInBackground { objects: List<ParseObject>, e: ParseException? ->
4       if (e == null) {
5           Log.d(Companion.TAG, "Objects: $objects")
6       } else {
7           Log.e(Companion.TAG, "Parse Error: ", e)
8       }
9   }
```

matchesKeyInQuery

```kotlin
//Requires that a key’s value matches a value in an object returned by a different ParseQuery. Useful for multi-object querying.1   ParseQuery<ParseObject> query = new ParseQuery<>("Profile");
1   val query = ParseQuery<ParseObject>("Profile")
2   val innerQuery = ParseQuery<ParseObject>("Profile")
3   innerQuery.whereLessThan("friendCount", 50)
4   query.whereMatchesKeyInQuery("friendCount", "friendCount", innerQuery)
5   query.whereGreaterThan("friendCount", 10)
6   query.findInBackground { objects: List<ParseObject>, e: ParseException? ->
7       if (e == null) {
8           Log.d(Companion.TAG, "Objects: $objects")
9       } else {
10          Log.e(Companion.TAG, "Parse Error: ", e)
11      }
12  }
```

matchesQuery

```kotlin
//Requires that an object contained in the given key matches another query. Useful for multi-object querying.
1   val query = ParseQuery<ParseObject>("Profile")
2   val innerQuery = ParseQuery<ParseObject>("Membership")
3   innerQuery.whereGreaterThan("expirationDate", Date())
4   query.whereExists("premiumMembership")
5   query.whereMatchesQuery("premiumMembership", innerQuery)
6   query.findInBackground { objects: List<ParseObject>, e: ParseException? ->
7       if (e == null) {
8           Log.d(Companion.TAG, "Objects: $objects")
9       } else {
10          Log.e(Companion.TAG, "Parse Error: ", e)
11      }
12  }
```

notEqualTo

```kotlin
//Filters objects in which a specific key’s value is not equal to the provided value.
1   val query = ParseQuery<ParseObject>("Profile")
2   query.whereNotEqualTo("friendCount", 2)
3   query.findInBackground { objects: List<ParseObject>, e: ParseException? ->
4       if (e == null) {
5           Log.d(Companion.TAG, "Objects: $objects")
6       } else {
7           Log.e(Companion.TAG, "Parse Error: ", e)
8       }
9   }
```

startsWith

```kotlin
//Filters objects in which a string key’s value starts with the provided text value.
1   val query = ParseQuery<ParseObject>("Profile")
2   query.whereStartsWith("name", "Brit")
3   query.findInBackground { objects: List<ParseObject>, e: ParseException? ->
4       if (e == null) {
5           Log.d(Companion.TAG, "Objects: $objects")
6       } else {
7           Log.e(Companion.TAG, "Parse Error: ", e)
8       }
9   }
```
:::

## Query ordering

Essential in most queries, ordering can be easily achieved in Parse and even chained between two or more ordering constraints.

These are **Java** methods

:::CodeblockTabs
addAscending

```java
//Sort the results in ascending order, overwrites previous orderings. Multiple keys can be used to solve ordering ties.
1   ParseQuery<ParseObject> query = new ParseQuery<>("Profile");
2   query.addAscendingOrder("friendCount");
3   query.findInBackground((objects, e) -> {
4       if (e == null) {
5           Log.d(TAG, "Objects: " + objects);
6       } else {
7           Log.e(TAG, "Parse Error: ", e);
8       }
9 
10  });
```

addDescending

```java
//Sort the results in descending order, overwrites previous orderings. Multiple keys can be used to solve ordering ties.
1   ParseQuery<ParseObject> query = new ParseQuery<>("Profile");
2   query.addDescendingOrder("friendCount");
3   query.findInBackground((objects, e) -> {
4       if (e == null) {
5           Log.d(TAG, "Objects: " + objects);
6       } else {
7           Log.e(TAG, "Parse Error: ", e);
8       }
9 
10  });
```

ascending

```java
//Sort the results in ascending order, this can be chained without overwriting previous orderings. Multiple keys can be used to solve ordering ties.
1   ParseQuery<ParseObject> query = new ParseQuery<>("Profile");
2   query.orderByAscending("friendCount");
3   query.findInBackground((objects, e) -> {
4       if (e == null) {
5           Log.d(TAG, "Objects: " + objects);
6       } else {
7           Log.e(TAG, "Parse Error: ", e);
8       }
9 
10  });
```

descending

```java
//Sort the results in descending order, this can be chained without overwriting previous orderings. Multiple keys can be used to solve ordering ties.
1   ParseQuery<ParseObject> query = new ParseQuery<>("Profile");
2   query.orderByDescending("friendCount");
3   query.findInBackground((objects, e) -> {
4       if (e == null) {
5           Log.d(TAG, "Objects: " + objects);
6       } else {
7           Log.e(TAG, "Parse Error: ", e);
8       }
9 
10  });
```
:::

These are **Kotlin** methods

:::CodeblockTabs
addAscending

```kotlin
//Sort the results in ascending order, overwrites previous orderings. Multiple keys can be used to solve ordering ties.
1   val query = ParseQuery<ParseObject>("Profile")
2   query.addAscendingOrder("friendCount")
3   query.findInBackground { objects: List<ParseObject>, e: ParseException? ->
4       if (e == null) {
5           Log.d(Companion.TAG, "Objects: $objects")
6       } else {
7           Log.e(Companion.TAG, "Parse Error: ", e)
8       }
9   }
```

addDescending

```kotlin
//Sort the results in descending order, overwrites previous orderings. Multiple keys can be used to solve ordering ties.
1   val query = ParseQuery<ParseObject>("Profile")
2   query.addDescendingOrder("friendCount")
3   query.findInBackground { objects: List<ParseObject>, e: ParseException? ->
4       if (e == null) {
5           Log.d(Companion.TAG, "Objects: $objects")
6       } else {
7           Log.e(Companion.TAG, "Parse Error: ", e)
8       }
9   }
```

ascending

```kotlin
//Sort the results in ascending order, this can be chained without overwriting previous orderings. Multiple keys can be used to solve ordering ties.
1   val query = ParseQuery<ParseObject>("Profile")
2   query.orderByAscending("friendCount")
3   query.findInBackground { objects: List<ParseObject>, e: ParseException? ->
4       if (e == null) {
5           Log.d(Companion.TAG, "Objects: $objects")
6       } else {
7           Log.e(Companion.TAG, "Parse Error: ", e)
8       }
9   }
```

descending

```kotlin
//Sort the results in descending order, this can be chained without overwriting previous orderings. Multiple keys can be used to solve ordering ties.
1   val query = ParseQuery<ParseObject>("Profile")
2   query.orderByDescending("friendCount")
3   query.findInBackground { objects: List<ParseObject>, e: ParseException? ->
4       if (e == null) {
5           Log.d(Companion.TAG, "Objects: $objects")
6       } else {
7           Log.e(Companion.TAG, "Parse Error: ", e)
8       }
9   }
```
:::

## Field selecting

These methods affect which field values can be in your query results.

These are **Java** methods

:::CodeblockTabs
include

```java
//Return all fields in the returned objects except the ones specified.
1   ParseQuery<ParseObject> query = new ParseQuery<>("Profile");
2   query.whereExists("premiumMembership");
3   query.include("premiumMembership");
4   query.findInBackground((objects, e) -> {
5       if (e == null) {
6           Log.d(TAG, "Objects: " + objects);
7           Log.d(TAG, "Object Premium Membership: " + objects.get(0).get("premiumMembership"));
8       } else {
9           Log.e(TAG, "Parse Error: ", e);
10      }
11
12  });
```

select

```java
//Return only the specified fields in the returned objects.
1   ParseQuery<ParseObject> query = new ParseQuery<>("Profile");
2   query.selectKeys(List.of("name"));
3   query.findInBackground((objects, e) -> {
4       if (e == null) {
5           Log.d(TAG, "Objects: " + objects);
6           Log.d(TAG, "Object name: " + objects.get(0).get("name"));
7       } else {
8           Log.e(TAG, "Parse Error: ", e);
9       }
10
11 });
```
:::

These are **Kotlin** methods

:::CodeblockTabs
include

```kotlin
//Return all fields in the returned objects except the ones specified.
1   val query = ParseQuery<ParseObject>("Profile")
2   query.whereExists("premiumMembership")
3   query.include("premiumMembership")
4   query.findInBackground { objects: List<ParseObject>, e: ParseException? ->
5       if (e == null) {
6           Log.d(Companion.TAG, "Objects: $objects")
7           Log.d(
8               Companion.TAG,
9               "Object Premium Membership: " + objects[0]["premiumMembership"]
10          )
11      } else {
12          Log.e(Companion.TAG, "Parse Error: ", e)
13      }
14  }
```

select

```kotlin
//Return only the specified fields in the returned objects.
1   val query = ParseQuery<ParseObject>("Profile")
2   query.selectKeys(java.util.List.of("name"))
3   query.findInBackground { objects: List<ParseObject>, e: ParseException? ->
4       if (e == null) {
5           Log.d(Companion.TAG, "Objects: $objects")
6           Log.d(Companion.TAG, "Object name: " + objects[0]["name"])
7       } else {
8           Log.e(Companion.TAG, "Parse Error: ", e)
9       }
10  }
```
:::

## Geopoint querying

These are methods specific to GeoPoint querying.

These are **Java** Methods

:::CodeblockTabs
near

```java
//Order objects by how near the key value is from the given GeoPoint.
1   ParseQuery<ParseObject> query = new ParseQuery<>("Profile");
2   query.whereNear("lastLoginLocation", new ParseGeoPoint(37.38412167489413, -122.01268034622319));
3   query.findInBackground((objects, e) -> {
4       if (e == null) {
5           Log.d(TAG, "Objects: " + objects);
6       } else {
7           Log.e(TAG, "Parse Error: ", e);
8       }
9
10  });
```

polygonContains

```java
//Find objects whose key value contains the specified GeoPoint.
1   ParseQuery<ParseObject> query = new ParseQuery<>("Profile");
2   query.wherePolygonContains("lastLoginLocation", new ParseGeoPoint(37.38412167489413, -122.01268034622319));
3   query.findInBackground((objects, e) -> {
4       if (e == null) {
5           Log.d(TAG, "Objects: " + objects);
6       } else {
7           Log.e(TAG, "Parse Error: ", e);
8       }
9 
10  });
```

withinGeoBox

```java
//Find objects whose key value is contained within the specified bounding box, composed by two GeoPoint values that set the lower-left and upper-right corner values.
1   ParseQuery<ParseObject> query = new ParseQuery<>("Profile");
2   query.whereWithinGeoBox("lastLoginLocation", new ParseGeoPoint(37.48412167489413, -122.11268034622319), new ParseGeoPoint(37.28412167489413, -121.91268034622319));
3   query.findInBackground((objects, e) -> {
4       if (e == null) {
5           Log.d(TAG, "Objects: " + objects);
6       } else {
7           Log.e(TAG, "Parse Error: ", e);
8       }
9 
10  });
```

withinKilometers

```java
//Find objects whose key value is near the given GeoPoint and within the maxDistance value. The sorted boolean value determines if the results should be sorted by distance ascending.
1   ParseQuery<ParseObject> query = new ParseQuery<>("Profile");
2   query.whereWithinKilometers("lastLoginLocation", new ParseGeoPoint(37.38412167489413, -122.01268034622319), 100);
3   query.findInBackground((objects, e) -> {
4       if (e == null) {
5           Log.d(TAG, "Objects: " + objects);
6       } else {
7           Log.e(TAG, "Parse Error: ", e);
8       }
9 
10  });
```
:::

:::CodeblockTabs
withinMiles

```java
//Find objects whose key value is near the given GeoPoint and within the maxDistance value. The sorted boolean value determines if the results should be sorted by distance ascending.
1   ParseQuery<ParseObject> query = new ParseQuery<>("Profile");
2   query.whereWithinMiles("lastLoginLocation", new ParseGeoPoint(37.38412167489413, -122.01268034622319), 100);
3   query.findInBackground((objects, e) -> {
4       if (e == null) {
5           Log.d(TAG, "Objects: " + objects);
6       } else {
7           Log.e(TAG, "Parse Error: ", e);
8       }
9 
10  });
```

withinPolygon

```java
//Find objects whose key value is contained within the specified polygon, composed of an array of GeoPoints (at least three). If the polygon path is open, it will be closed automatically by Parse connecting the last and first points.
1   ParseQuery<ParseObject> query = new ParseQuery<>("Profile");
2   query.whereWithinPolygon("lastLoginLocation", List.of(new ParseGeoPoint(37.48412167489413, -122.11268034622319),
3           new ParseGeoPoint(37.48412167489413, -121.91268034622319),
4           new ParseGeoPoint(37.28412167489413, -121.91268034622319),
5           new ParseGeoPoint(37.28412167489413, -122.01268034622319)));
6   query.findInBackground((objects, e) -> {
7       if (e == null) {
8           Log.d(TAG, "Objects: " + objects);
9       } else {
10          Log.e(TAG, "Parse Error: ", e);
11      }
12
13  });
```

withinRadians

```java
//Find objects whose key value is near the given GeoPoint and within the maxDistance value. The sorted boolean value determines if the results should be sorted by distance ascending.
1   ParseQuery<ParseObject> query = new ParseQuery<>("Profile");
2   query.whereWithinRadians("lastLoginLocation", new ParseGeoPoint(37.38412167489413, -122.01268034622319), 100);
3   query.findInBackground((objects, e) -> {
4       if (e == null) {
5           Log.d(TAG, "Objects: " + objects);
6       } else {
7           Log.e(TAG, "Parse Error: ", e);
8       }
9 
10  });
```
:::

These are **Kotlin** methods

:::CodeblockTabs
near

```kotlin
//Order objects by how near the key value is from the given GeoPoint.
1   val query = ParseQuery<ParseObject>("Profile")
2   query.whereNear("lastLoginLocation", ParseGeoPoint(37.38412167489413, -122.01268034622319))
3   query.findInBackground { objects: List<ParseObject>, e: ParseException? ->
4       if (e == null) {
5           Log.d(Companion.TAG, "Objects: $objects")
6       } else {
7           Log.e(Companion.TAG, "Parse Error: ", e)
8       }
9   }
```

polygonContains

```kotlin
//Find objects whose key value contains the specified GeoPoint.
1   val query = ParseQuery<ParseObject>("Profile")
2   query.wherePolygonContains(
3       "lastLoginLocation",
4       ParseGeoPoint(37.38412167489413, -122.01268034622319)
5   )
6   query.findInBackground { objects: List<ParseObject>, e: ParseException? ->
7       if (e == null) {
8           Log.d(Companion.TAG, "Objects: $objects")
9       } else {
10          Log.e(Companion.TAG, "Parse Error: ", e)
11      }
12  }
```

withinGeoBox

```kotlin
//Find objects whose key value is contained within the specified bounding box, composed by two GeoPoint values that set the lower-left and upper-right corner values.
1   val query = ParseQuery<ParseObject>("Profile")
2   query.whereWithinGeoBox(
3       "lastLoginLocation",
4       ParseGeoPoint(37.48412167489413, -122.11268034622319),
5       ParseGeoPoint(37.28412167489413, -121.91268034622319)
6   )
7   query.findInBackground { objects: List<ParseObject>, e: ParseException? ->
8       if (e == null) {
9           Log.d(Companion.TAG, "Objects: $objects")
10      } else {
11          Log.e(Companion.TAG, "Parse Error: ", e)
12      }
13  }
```

withinKilometers

```kotlin
//Find objects whose key value is near the given GeoPoint and within the maxDistance value. The sorted boolean value determines if the results should be sorted by distance ascending.
1   val query = ParseQuery<ParseObject>("Profile")
2   query.whereWithinKilometers(
3       "lastLoginLocation",
4       ParseGeoPoint(37.38412167489413, -122.01268034622319),
5       100.0
6   )
7   query.findInBackground { objects: List<ParseObject>, e: ParseException? ->
8       if (e == null) {
9           Log.d(Companion.TAG, "Objects: $objects")
10      } else {
11          Log.e(Companion.TAG, "Parse Error: ", e)
12      }
13  }
```
:::

:::CodeblockTabs
withinMiles

```kotlin
//Find objects whose key value is near the given GeoPoint and within the maxDistance value. The sorted boolean value determines if the results should be sorted by distance ascending.
1   val query = ParseQuery<ParseObject>("Profile")
2   query.whereWithinMiles(
3       "lastLoginLocation",
4       ParseGeoPoint(37.38412167489413, -122.01268034622319),
5       100.0
6   )
7   query.findInBackground { objects: List<ParseObject>, e: ParseException? ->
8       if (e == null) {
9           Log.d(Companion.TAG, "Objects: $objects")
10      } else {
11          Log.e(Companion.TAG, "Parse Error: ", e)
12      }
13  }
```

withinPolygon

```kotlin
//Find objects whose key value is contained within the specified polygon, composed of an array of GeoPoints (at least three). If the polygon path is open, it will be closed automatically by Parse connecting the last and first points.
1   val query = ParseQuery<ParseObject>("Profile")
2   query.whereWithinPolygon(
3       "lastLoginLocation", java.util.List.of(
4           ParseGeoPoint(37.48412167489413, -122.11268034622319),
5           ParseGeoPoint(37.48412167489413, -121.91268034622319),
6           ParseGeoPoint(37.28412167489413, -121.91268034622319),
7           ParseGeoPoint(37.28412167489413, -122.01268034622319)
8       )
9   )
10  query.findInBackground { objects: List<ParseObject>, e: ParseException? ->
11      if (e == null) {
12          Log.d(Companion.TAG, "Objects: $objects")
13      } else {
14          Log.e(Companion.TAG, "Parse Error: ", e)
15      }
16  }
```

withinRadians

```kotlin
//Find objects whose key value is near the given GeoPoint and within the maxDistance value. The sorted boolean value determines if the results should be sorted by distance ascending.
1   val query = ParseQuery<ParseObject>("Profile")
2   query.whereWithinRadians(
3       "lastLoginLocation",
4       ParseGeoPoint(37.38412167489413, -122.01268034622319),
5       100.0
6   )
7   query.findInBackground { objects: List<ParseObject>, e: ParseException? ->
8       if (e == null) {
9           Log.d(Companion.TAG, "Objects: $objects")
10      } else {
11          Log.e(Companion.TAG, "Parse Error: ", e)
12      }
13  }
```
:::

## Pagination

These methods are related to pagination utilities, useful for queries that will retrieve a large number of results.

These are **Java** methods

:::CodeblockTabs
limit

```java
//Sets the maximum value of returned results, the default value is 100.
1   ParseQuery<ParseObject> query = new ParseQuery<>("Profile");
2   query.setLimit(2);
3   query.findInBackground((objects, e) -> {
4       if (e == null) {
5           Log.d(TAG, "Objects: " + objects);
6       } else {
7           Log.e(TAG, "Parse Error: ", e);
8       }
9 
10  });
```

skip

```java
//Skips the first n results in the query, essential for pagination.
1   ParseQuery<ParseObject> query = new ParseQuery<>("Profile");
2   query.setSkip(2);
3   query.findInBackground((objects, e) -> {
4       if (e == null) {
5           Log.d(TAG, "Objects: " + objects);
6       } else {
7           Log.e(TAG, "Parse Error: ", e);
8       }
9 
10  });
```
:::

These are **Kotlin** methods

:::CodeblockTabs
limit

```kotlin
//Sets the maximum value of returned results, the default value is 100.
1   val query = ParseQuery<ParseObject>("Profile")
2   query.limit = 2
3   query.findInBackground { objects: List<ParseObject>, e: ParseException? ->
4       if (e == null) {
5           Log.d(Companion.TAG, "Objects: $objects")
6       } else {
7           Log.e(Companion.TAG, "Parse Error: ", e)
8       }
9   }
```

skip

```kotlin
//Skips the first n results in the query, essential for pagination.
1   val query = ParseQuery<ParseObject>("Profile")
2   query.skip = 2
3   query.findInBackground { objects: List<ParseObject>, e: ParseException? ->
4       if (e == null) {
5           Log.d(Companion.TAG, "Objects: $objects")
6       } else {
7           Log.e(Companion.TAG, "Parse Error: ", e)
8       }
9   }
```
:::

## Local datastore

These methods enable selecting the source of the queries and using a local datastore.

These are **Java** methods

:::CodeblockTabs
fromLocalDatastore

```java
//Changes the source of this query to all pinned objects.
1   ParseQuery<ParseObject> query = new ParseQuery<>("Profile");
2   //If you want use LocalDataStore you should enable local data store in the App.java or App.kt file.
3   query.fromLocalDatastore();
4   query.findInBackground((objects, e) -> {
5       if (e == null) {
6           Log.d(TAG, "Objects: " + objects);
7       } else {
8           Log.e(TAG, "Parse Error: ", e);
9       }
10
11  });
```

fromNetwork

```java
//Changes the source of this query to your online server.
1   ParseQuery<ParseObject> query = new ParseQuery<>("Profile");
2   query.fromNetwork();
3   query.findInBackground((objects, e) -> {
4       if (e == null) {
5           Log.d(TAG, "Objects: " + objects);
6       } else {
7           Log.e(TAG, "Parse Error: ", e);
8       }
9 
10  });
```

fromPin

```java
//Changes the source of this query to the default group of pinned objects.
1   ParseQuery<ParseObject> query = new ParseQuery<>("Profile");
2   query.fromPin();
3   query.findInBackground((objects, e) -> {
4       if (e == null) {
5           Log.d(TAG, "Objects: " + objects);
6       } else {
7           Log.e(TAG, "Parse Error: ", e);
8       }
9 
10  });
```

fromPinWithName

```java
//Changes the source of this query to a specific group of pinned objects.
1   ParseQuery<ParseObject> query = new ParseQuery<>("Profile");
2   query.fromPin("pinnedObjects");
3   query.findInBackground((objects, e) -> {
4      if (e == null) {
5           Log.d(TAG, "Objects: " + objects);
6       } else {
7           Log.e(TAG, "Parse Error: ", e);
8       }
9   });
```
:::

These are **Kotlin** methods

:::CodeblockTabs
fromLocalDatastore

```kotlin
//Changes the source of this query to all pinned objects.
1   val query = ParseQuery<ParseObject>("Profile")
2   //If you want use LocalDataStore you should enable local data store in the App.java or App.kt file.
3   query.fromLocalDatastore()
4   query.findInBackground { objects: List<ParseObject>, e: ParseException? ->
5       if (e == null) {
6           Log.d(Companion.TAG, "Objects: $objects")
7       } else {
8           Log.e(Companion.TAG, "Parse Error: ", e)
9       }
10  }
```

fromNetwork

```kotlin
//Changes the source of this query to your online server.
1   val query = ParseQuery<ParseObject>("Profile")
2   query.fromNetwork()
3   query.findInBackground { objects: List<ParseObject>, e: ParseException? ->
4       if (e == null) {
5           Log.d(Companion.TAG, "Objects: $objects")
6       } else {
7           Log.e(Companion.TAG, "Parse Error: ", e)
8       }
9  }
```

fromPin

```kotlin
//Changes the source of this query to the default group of pinned objects.
1   val query = ParseQuery<ParseObject>("Profile")
2   query.fromPin()
3   query.findInBackground { objects: List<ParseObject>, e: ParseException? ->
4       if (e == null) {
5           Log.d(Companion.TAG, "Objects: $objects")
6       } else {
7           Log.e(Companion.TAG, "Parse Error: ", e)
8       }
9   }
```

fromPinWithName

```kotlin
//Changes the source of this query to a specific group of pinned objects.
1   val query = ParseQuery<ParseObject>("Profile")
2   query.fromPin("pinnedObjects")
3   query.findInBackground { objects: List<ParseObject>, e: ParseException? ->
4       if (e == null) {
5           Log.d(Companion.TAG, "Objects: $objects")
6       } else {
7           Log.e(Companion.TAG, "Parse Error: ", e)
8       }
9   }
```
:::

## Conclusion

At the end of this guide, you learned how to use different query types in Android.
