# CollectionReference

# CollectionReference


```
class CollectionReference : Query
```

<br />

|---|---|---|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) |||
| ↳ | [com.google.firebase.firestore.Query](https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Query) ||
|   | ↳ | [com.google.firebase.firestore.CollectionReference](https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/CollectionReference) |

*** ** * ** ***

A `CollectionReference` can be used for adding documents, getting document references, and querying for documents (using the methods inherited from `Query`).

**Subclassing Note**: Cloud Firestore classes are not meant to be subclassed except for use in test mocks. Subclassing is not supported in production code and new SDK releases may break code that does so.

## Summary

| ### Public functions |
|---|---|
| `https://developers.google.com/android/reference/com/google/android/gms/tasks/Task.html<https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/DocumentReference!>` | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/CollectionReference#add(java.lang.Object)(data: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)` Adds a new document to this collection with the specified data, assigning it a document ID automatically. |
| `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/DocumentReference` | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/CollectionReference#document()()` Returns a `DocumentReference` pointing to a new document with an auto-generated ID within this collection. |
| `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/DocumentReference` | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/CollectionReference#document(java.lang.String)(documentPath: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)` Gets a `DocumentReference` instance that refers to the document at the specified path within this collection. |
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html` | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/CollectionReference#getId()()` |
| `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/DocumentReference?` | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/CollectionReference#getParent()()` Gets a `DocumentReference` to the document that contains this collection. |
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html` | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/CollectionReference#getPath()()` Gets the path of this collection (relative to the root of the database) as a slash-separated string. |

| ### Inherited functions |
|---|
| From [com.google.firebase.firestore.Query](https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Query) |---|---| | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/ListenerRegistration` | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Query#addSnapshotListener(com.google.firebase.firestore.EventListener<com.google.firebase.firestore.QuerySnapshot>)(listener: https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/EventListener<https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/QuerySnapshot!>)` Starts listening to this query. | | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/ListenerRegistration` | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Query#addSnapshotListener(android.app.Activity,com.google.firebase.firestore.EventListener<com.google.firebase.firestore.QuerySnapshot>)( activity: https://developer.android.com/reference/kotlin/android/app/Activity.html, listener: https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/EventListener<https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/QuerySnapshot!> )` Starts listening to this query using an Activity-scoped listener. | | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/ListenerRegistration` | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Query#addSnapshotListener(java.util.concurrent.Executor,com.google.firebase.firestore.EventListener<com.google.firebase.firestore.QuerySnapshot>)( executor: https://developer.android.com/reference/kotlin/java/util/concurrent/Executor.html, listener: https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/EventListener<https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/QuerySnapshot!> )` Starts listening to this query. | | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/ListenerRegistration` | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Query#addSnapshotListener(com.google.firebase.firestore.MetadataChanges,com.google.firebase.firestore.EventListener<com.google.firebase.firestore.QuerySnapshot>)( metadataChanges: https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/MetadataChanges, listener: https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/EventListener<https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/QuerySnapshot!> )` Starts listening to this query with the given options. | | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/ListenerRegistration` | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Query#addSnapshotListener(com.google.firebase.firestore.SnapshotListenOptions,com.google.firebase.firestore.EventListener<com.google.firebase.firestore.QuerySnapshot>)( options: https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/SnapshotListenOptions, listener: https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/EventListener<https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/QuerySnapshot!> )` Starts listening to this query with the given options. | | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/ListenerRegistration` | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Query#addSnapshotListener(android.app.Activity,com.google.firebase.firestore.MetadataChanges,com.google.firebase.firestore.EventListener<com.google.firebase.firestore.QuerySnapshot>)( activity: https://developer.android.com/reference/kotlin/android/app/Activity.html, metadataChanges: https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/MetadataChanges, listener: https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/EventListener<https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/QuerySnapshot!> )` Starts listening to this query with the given options, using an Activity-scoped listener. | | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/ListenerRegistration` | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Query#addSnapshotListener(java.util.concurrent.Executor,com.google.firebase.firestore.MetadataChanges,com.google.firebase.firestore.EventListener<com.google.firebase.firestore.QuerySnapshot>)( executor: https://developer.android.com/reference/kotlin/java/util/concurrent/Executor.html, metadataChanges: https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/MetadataChanges, listener: https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/EventListener<https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/QuerySnapshot!> )` Starts listening to this query with the given options. | | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/AggregateQuery` | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Query#aggregate(com.google.firebase.firestore.AggregateField,com.google.firebase.firestore.AggregateField...)( aggregateField: https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/AggregateField, aggregateFields: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html<https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/AggregateField!> )` Calculates the specified aggregations over the documents in the result set of the given query without actually downloading the documents. | | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/AggregateQuery` | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Query#count()()` Returns a query that counts the documents in the result set of this query. | | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Query` | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Query#endAt(java.lang.Object...)(fieldValues: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html!>!)` Creates and returns a new `Query` that ends at the provided fields relative to the order of the query. | | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Query` | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Query#endAt(com.google.firebase.firestore.DocumentSnapshot)(snapshot: https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/DocumentSnapshot)` Creates and returns a new `Query` that ends at the provided document (inclusive). | | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Query` | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Query#endBefore(java.lang.Object...)(fieldValues: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html!>!)` Creates and returns a new `Query` that ends before the provided fields relative to the order of the query. | | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Query` | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Query#endBefore(com.google.firebase.firestore.DocumentSnapshot)(snapshot: https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/DocumentSnapshot)` Creates and returns a new `Query` that ends before the provided document (exclusive). | | `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Query#equals(java.lang.Object)(o: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html!)` | | `https://developers.google.com/android/reference/com/google/android/gms/tasks/Task.html<https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/QuerySnapshot!>` | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Query#get()()` Executes the query and returns the results as a `QuerySnapshot`. | | `https://developers.google.com/android/reference/com/google/android/gms/tasks/Task.html<https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/QuerySnapshot!>` | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Query#get(com.google.firebase.firestore.Source)(source: https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Source)` Executes the query and returns the results as a `QuerySnapshot`. | | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/FirebaseFirestore` | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Query#getFirestore()()` Gets the Cloud Firestore instance associated with this query. | | `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Query#hashCode()()` | | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Query` | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Query#limit(long)(limit: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html)` Creates and returns a new `Query` that only returns the first matching documents up to the specified number. | | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Query` | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Query#limitToLast(long)(limit: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html)` Creates and returns a new `Query` that only returns the last matching documents up to the specified number. | | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Query` | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Query#orderBy(java.lang.String)(field: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)` Creates and returns a new `Query` that's additionally sorted by the specified field. | | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Query` | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Query#orderBy(com.google.firebase.firestore.FieldPath)(fieldPath: https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/FieldPath)` Creates and returns a new `Query` that's additionally sorted by the specified field. | | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Query` | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Query#orderBy(java.lang.String,com.google.firebase.firestore.Query.Direction)(field: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html, direction: https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Query.Direction)` Creates and returns a new `Query` that's additionally sorted by the specified field, optionally in descending order instead of ascending. | | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Query` | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Query#orderBy(com.google.firebase.firestore.FieldPath,com.google.firebase.firestore.Query.Direction)(fieldPath: https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/FieldPath, direction: https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Query.Direction)` Creates and returns a new `Query` that's additionally sorted by the specified field, optionally in descending order instead of ascending. | | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Query` | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Query#startAfter(java.lang.Object...)(fieldValues: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html!>!)` Creates and returns a new `Query` that starts after the provided fields relative to the order of the query. | | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Query` | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Query#startAfter(com.google.firebase.firestore.DocumentSnapshot)(snapshot: https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/DocumentSnapshot)` Creates and returns a new `Query` that starts after the provided document (exclusive). | | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Query` | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Query#startAt(java.lang.Object...)(fieldValues: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html!>!)` Creates and returns a new `Query` that starts at the provided fields relative to the order of the query. | | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Query` | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Query#startAt(com.google.firebase.firestore.DocumentSnapshot)(snapshot: https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/DocumentSnapshot)` Creates and returns a new `Query` that starts at the provided document (inclusive). | | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Query` | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Query#where(com.google.firebase.firestore.Filter)(filter: https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Filter)` Creates and returns a new `Query` with the additional filter. | | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Query` | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Query#whereArrayContains(java.lang.String,java.lang.Object)(field: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html, value: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)` Creates and returns a new `Query` with the additional filter that documents must contain the specified field, the value must be an array, and that the array must contain the provided value. | | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Query` | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Query#whereArrayContains(com.google.firebase.firestore.FieldPath,java.lang.Object)(fieldPath: https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/FieldPath, value: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)` Creates and returns a new `Query` with the additional filter that documents must contain the specified field, the value must be an array, and that the array must contain the provided value. | | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Query` | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Query#whereArrayContainsAny(java.lang.String,java.util.List<? extends java.lang.Object>)(field: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html, values: (https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-list/index.html<https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html!>)` Creates and returns a new `Query` with the additional filter that documents must contain the specified field, the value must be an array, and that the array must contain at least one value from the provided list. | | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Query` | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Query#whereArrayContainsAny(com.google.firebase.firestore.FieldPath,java.util.List<? extends java.lang.Object>)(fieldPath: https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/FieldPath, values: (https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-list/index.html<https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html!>)` Creates and returns a new `Query` with the additional filter that documents must contain the specified field, the value must be an array, and that the array must contain at least one value from the provided list. | | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Query` | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Query#whereEqualTo(java.lang.String,java.lang.Object)(field: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html, value: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html?)` Creates and returns a new `Query` with the additional filter that documents must contain the specified field and the value should be equal to the specified value. | | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Query` | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Query#whereEqualTo(com.google.firebase.firestore.FieldPath,java.lang.Object)(fieldPath: https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/FieldPath, value: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html?)` Creates and returns a new `Query` with the additional filter that documents must contain the specified field and the value should be equal to the specified value. | | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Query` | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Query#whereGreaterThan(java.lang.String,java.lang.Object)(field: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html, value: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)` Creates and returns a new `Query` with the additional filter that documents must contain the specified field and the value should be greater than the specified value. | | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Query` | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Query#whereGreaterThan(com.google.firebase.firestore.FieldPath,java.lang.Object)(fieldPath: https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/FieldPath, value: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)` Creates and returns a new `Query` with the additional filter that documents must contain the specified field and the value should be greater than the specified value. | | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Query` | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Query#whereGreaterThanOrEqualTo(java.lang.String,java.lang.Object)(field: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html, value: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)` Creates and returns a new `Query` with the additional filter that documents must contain the specified field and the value should be greater than or equal to the specified value. | | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Query` | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Query#whereGreaterThanOrEqualTo(com.google.firebase.firestore.FieldPath,java.lang.Object)(fieldPath: https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/FieldPath, value: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)` Creates and returns a new `Query` with the additional filter that documents must contain the specified field and the value should be greater than or equal to the specified value. | | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Query` | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Query#whereIn(java.lang.String,java.util.List<? extends java.lang.Object>)(field: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html, values: (https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-list/index.html<https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html!>)` Creates and returns a new `Query` with the additional filter that documents must contain the specified field and the value must equal one of the values from the provided list. | | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Query` | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Query#whereIn(com.google.firebase.firestore.FieldPath,java.util.List<? extends java.lang.Object>)(fieldPath: https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/FieldPath, values: (https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-list/index.html<https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html!>)` Creates and returns a new `Query` with the additional filter that documents must contain the specified field and the value must equal one of the values from the provided list. | | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Query` | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Query#whereLessThan(java.lang.String,java.lang.Object)(field: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html, value: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)` Creates and returns a new `Query` with the additional filter that documents must contain the specified field and the value should be less than the specified value. | | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Query` | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Query#whereLessThan(com.google.firebase.firestore.FieldPath,java.lang.Object)(fieldPath: https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/FieldPath, value: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)` Creates and returns a new `Query` with the additional filter that documents must contain the specified field and the value should be less than the specified value. | | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Query` | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Query#whereLessThanOrEqualTo(java.lang.String,java.lang.Object)(field: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html, value: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)` Creates and returns a new `Query` with the additional filter that documents must contain the specified field and the value should be less than or equal to the specified value. | | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Query` | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Query#whereLessThanOrEqualTo(com.google.firebase.firestore.FieldPath,java.lang.Object)(fieldPath: https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/FieldPath, value: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)` Creates and returns a new `Query` with the additional filter that documents must contain the specified field and the value should be less than or equal to the specified value. | | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Query` | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Query#whereNotEqualTo(java.lang.String,java.lang.Object)(field: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html, value: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html?)` Creates and returns a new `Query` with the additional filter that documents must contain the specified field and the value does not equal the specified value. | | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Query` | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Query#whereNotEqualTo(com.google.firebase.firestore.FieldPath,java.lang.Object)(fieldPath: https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/FieldPath, value: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html?)` Creates and returns a new `Query` with the additional filter that documents must contain the specified field and the value does not equal the specified value. | | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Query` | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Query#whereNotIn(java.lang.String,java.util.List<? extends java.lang.Object>)(field: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html, values: (https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-list/index.html<https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html!>)` Creates and returns a new `Query` with the additional filter that documents must contain the specified field and the value does not equal any of the values from the provided list. | | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Query` | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Query#whereNotIn(com.google.firebase.firestore.FieldPath,java.util.List<? extends java.lang.Object>)(fieldPath: https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/FieldPath, values: (https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-list/index.html<https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html!>)` Creates and returns a new `Query` with the additional filter that documents must contain the specified field and the value does not equal any of the values from the provided list. | |

| ### Inherited properties |
|---|
| From [com.google.firebase.firestore.Query](https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Query) |---|---| | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/FirebaseFirestore!` | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/Query#firestore()` | |

## Public functions

### add

```
fun add(data: Any): Task<DocumentReference!>
```

Adds a new document to this collection with the specified data, assigning it a document ID automatically.

| Parameters |
|---|---|
| `data: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html` | The data to write to the document (like a Map or a POJO containing the desired document contents). |

| Returns |
|---|---|
| `https://developers.google.com/android/reference/com/google/android/gms/tasks/Task.html<https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/DocumentReference!>` | A Task that will be resolved with the `DocumentReference` of the newly created document. |

### document

```
fun document(): DocumentReference
```

Returns a `DocumentReference` pointing to a new document with an auto-generated ID within this collection.

| Returns |
|---|---|
| `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/DocumentReference` | A `DocumentReference` pointing to a new document with an auto-generated ID. |

### document

```
fun document(documentPath: String): DocumentReference
```

Gets a `DocumentReference` instance that refers to the document at the specified path within this collection.

| Parameters |
|---|---|
| `documentPath: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html` | A slash-separated relative path to a document. |

| Returns |
|---|---|
| `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/DocumentReference` | The `DocumentReference` instance. |

### getId

```
fun getId(): String
```

| Returns |
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html` | The ID of the collection. |

### getParent

```
fun getParent(): DocumentReference?
```

Gets a `DocumentReference` to the document that contains this collection. Only subcollections are contained in a document. For root collections, returns `null`.

| Returns |
|---|---|
| `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/DocumentReference?` | The `DocumentReference` that contains this collection or `null` if this is a root collection. |

### getPath

```
fun getPath(): String
```

Gets the path of this collection (relative to the root of the database) as a slash-separated string.

| Returns |
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html` | The path of this collection. |