> Documentation index: https://firebase.google.com/docs/reference/llms.txt

# DocumentSnapshot


```
public class DocumentSnapshot
```

<br />

Known direct subclasses [QueryDocumentSnapshot](https://firebase.google.com/docs/reference/android/com/google/firebase/firestore/QueryDocumentSnapshot.md.txt)

|---|---|
| `QueryDocumentSnapshot` | A `QueryDocumentSnapshot` contains data read from a document in your Cloud Firestore database as part of a query. |

*** ** * ** ***

A `DocumentSnapshot` contains data read from a document in your Cloud Firestore database. The data can be extracted with the `getData` or `get` methods.

If the `DocumentSnapshot` points to a non-existing document, `getData` and its corresponding methods will return `null`. You can always explicitly check for a document's existence by calling `exists`.

**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

| ### Nested types |
|---|
| `public enum DocumentSnapshot.ServerTimestampBehavior` Controls the return value for server timestamps that have not yet been set to their final value. |

| ### Public fields |
|---|---|
| `final SnapshotMetadata` | `metadata` |

| ### Public methods |
|---|---|
| `boolean` | `contains(@NonNull String field)` Returns whether or not the field exists in the document. |
| `boolean` | `contains(@NonNull FieldPath fieldPath)` Returns whether or not the field exists in the document. |
| `boolean` | `equals(@Nullable Object obj)` |
| `boolean` | `exists()` |
| `@Nullable Object` | `get(@NonNull String field)` Returns the value at the field or `null` if the field doesn't exist. |
| `@Nullable Object` | `get(@NonNull FieldPath fieldPath)` Returns the value at the field or `null` if the field or document doesn't exist. |
| `@Nullable Object` | `get( @NonNull String field, @NonNull DocumentSnapshot.ServerTimestampBehavior serverTimestampBehavior )` Returns the value at the field or `null` if the field doesn't exist. |
| `@Nullable T` | `<T> get(@NonNull String field, @NonNull Class<T> valueType)` Returns the value at the field, converted to a POJO, or `null` if the field or document doesn't exist. |
| `@Nullable Object` | `get( @NonNull FieldPath fieldPath, @NonNull DocumentSnapshot.ServerTimestampBehavior serverTimestampBehavior )` Returns the value at the field or `null` if the field or document doesn't exist. |
| `@Nullable T` | `<T> get(@NonNull FieldPath fieldPath, @NonNull Class<T> valueType)` Returns the value at the field, converted to a POJO, or `null` if the field or document doesn't exist. |
| `@Nullable T` | `<T> get( @NonNull String field, @NonNull Class<T> valueType, @NonNull DocumentSnapshot.ServerTimestampBehavior serverTimestampBehavior )` Returns the value at the field, converted to a POJO, or `null` if the field or document doesn't exist. |
| `@Nullable T` | `<T> get( @NonNull FieldPath fieldPath, @NonNull Class<T> valueType, @NonNull DocumentSnapshot.ServerTimestampBehavior serverTimestampBehavior )` Returns the value at the field, converted to a POJO, or `null` if the field or document doesn't exist. |
| `@Nullable Blob` | `getBlob(@NonNull String field)` Returns the value of the field as a `Blob`. |
| `@Nullable Boolean` | `getBoolean(@NonNull String field)` Returns the value of the field as a boolean. |
| `@Nullable BsonObjectId` | `getBsonObjectId(@NonNull String field)` Returns the value of the field as a `BsonObjectId`. |
| `@Nullable BsonTimestamp` | `getBsonTimestamp(@NonNull String field)` Returns the value of the field as a `BsonTimestamp`. |
| `@Nullable Map<String, Object>` | `getData()` Returns the fields of the document as a Map or `null` if the document doesn't exist. |
| `@Nullable Map<String, Object>` | `getData( @NonNull DocumentSnapshot.ServerTimestampBehavior serverTimestampBehavior )` Returns the fields of the document as a Map or `null` if the document doesn't exist. |
| `@Nullable Date` | `getDate(@NonNull String field)` Returns the value of the field as a Date. |
| `@Nullable Date` | `getDate( @NonNull String field, @NonNull DocumentSnapshot.ServerTimestampBehavior serverTimestampBehavior )` Returns the value of the field as a Date. |
| `@Nullable Decimal128Value` | `getDecimal128Value(@NonNull String field)` Returns the value of the field as a 128-bit decimal. |
| `@Nullable DocumentReference` | `getDocumentReference(@NonNull String field)` Returns the value of the field as a DocumentReference. |
| `@Nullable Double` | `getDouble(@NonNull String field)` Returns the value of the field as a double. |
| `@Nullable GeoPoint` | `getGeoPoint(@NonNull String field)` Returns the value of the field as a GeoPoint. |
| `@NonNull String` | `getId()` |
| `@Nullable Int32Value` | `getInt32Value(@NonNull String field)` Returns the value of the field as a 32-bit integer. |
| `@Nullable Long` | `getLong(@NonNull String field)` Returns the value of the field as a long. |
| `@Nullable MaxKey` | `getMaxKey(@NonNull String field)` Returns the value of the field as a `MaxKey`. |
| `@NonNull SnapshotMetadata` | `getMetadata()` |
| `@Nullable MinKey` | `getMinKey(@NonNull String field)` Returns the value of the field as a `MinKey`. |
| `@NonNull DocumentReference` | `getReference()` Gets the reference to the document. |
| `@Nullable RegexValue` | `getRegexValue(@NonNull String field)` Returns the value of the field as a `RegexValue`. |
| `@Nullable String` | `getString(@NonNull String field)` Returns the value of the field as a String. |
| `@Nullable Timestamp` | `getTimestamp(@NonNull String field)` Returns the value of the field as a `com.google.firebase.Timestamp`. |
| `@Nullable Timestamp` | `getTimestamp( @NonNull String field, @NonNull DocumentSnapshot.ServerTimestampBehavior serverTimestampBehavior )` Returns the value of the field as a `com.google.firebase.Timestamp`. |
| `@Nullable VectorValue` | `getVectorValue(@NonNull String field)` Returns the value of the field as a `VectorValue` or `null` if the field does not exist in the document. |
| `int` | `hashCode()` |
| `@Nullable T` | `<T> toObject(@NonNull Class<T> valueType)` Returns the contents of the document converted to a POJO or `null` if the document doesn't exist. |
| `@Nullable T` | `<T> toObject( @NonNull Class<T> valueType, @NonNull DocumentSnapshot.ServerTimestampBehavior serverTimestampBehavior )` Returns the contents of the document converted to a POJO or `null` if the document doesn't exist. |
| `@NonNull String` | `toString()` |

| ### Extension functions |
|---|---|
| `final T` | `<T extends Object> FirestoreKt.getField( @NonNull DocumentSnapshot receiver, @NonNull String field )` Returns the value at the field, converted to a POJO, or null if the field or document doesn't exist. |
| `final T` | `<T extends Object> FirestoreKt.getField( @NonNull DocumentSnapshot receiver, @NonNull String field, @NonNull DocumentSnapshot.ServerTimestampBehavior serverTimestampBehavior )` Returns the value at the field, converted to a POJO, or null if the field or document doesn't exist. |
| `final T` | `<T extends Object> FirestoreKt.getField( @NonNull DocumentSnapshot receiver, @NonNull FieldPath fieldPath )` Returns the value at the field, converted to a POJO, or null if the field or document doesn't exist. |
| `final T` | `<T extends Object> FirestoreKt.getField( @NonNull DocumentSnapshot receiver, @NonNull FieldPath fieldPath, @NonNull DocumentSnapshot.ServerTimestampBehavior serverTimestampBehavior )` Returns the value at the field, converted to a POJO, or null if the field or document doesn't exist. |
| `final T` | `<T extends Object> FirestoreKt.toObject(@NonNull DocumentSnapshot receiver)` Returns the contents of the document converted to a POJO or null if the document doesn't exist. |
| `final T` | `<T extends Object> FirestoreKt.toObject( @NonNull DocumentSnapshot receiver, @NonNull DocumentSnapshot.ServerTimestampBehavior serverTimestampBehavior )` Returns the contents of the document converted to a POJO or null if the document doesn't exist. |

## Public fields

### metadata

```
public final SnapshotMetadata metadata
```

## Public methods

### contains

```
public boolean contains(@NonNull String field)
```

Returns whether or not the field exists in the document. Returns false if the document does not exist.

| Parameters |
|---|---|
| `@NonNull String field` | the path to the field. |

| Returns |
|---|---|
| `boolean` | true iff the field exists. |

### contains

```
public boolean contains(@NonNull FieldPath fieldPath)
```

Returns whether or not the field exists in the document. Returns false if the document does not exist.

| Parameters |
|---|---|
| `@NonNull FieldPath fieldPath` | the path to the field. |

| Returns |
|---|---|
| `boolean` | true iff the field exists. |

### equals

```
public boolean equals(@Nullable Object obj)
```

### exists

```
public boolean exists()
```

| Returns |
|---|---|
| `boolean` | true if the document existed in this snapshot. |

### get

```
public @Nullable Object get(@NonNull String field)
```

Returns the value at the field or `null` if the field doesn't exist.

| Parameters |
|---|---|
| `@NonNull String field` | The path to the field |

| Returns |
|---|---|
| `@Nullable Object` | The value at the given field or `null`. |

### get

```
public @Nullable Object get(@NonNull FieldPath fieldPath)
```

Returns the value at the field or `null` if the field or document doesn't exist.

| Parameters |
|---|---|
| `@NonNull FieldPath fieldPath` | The path to the field |

| Returns |
|---|---|
| `@Nullable Object` | The value at the given field or `null`. |

### get

```
public @Nullable Object get(
    @NonNull String field,
    @NonNull DocumentSnapshot.ServerTimestampBehavior serverTimestampBehavior
)
```

Returns the value at the field or `null` if the field doesn't exist.

| Parameters |
|---|---|
| `@NonNull String field` | The path to the field |
| `@NonNull DocumentSnapshot.ServerTimestampBehavior serverTimestampBehavior` | Configures the behavior for server timestamps that have not yet been set to their final value. |

| Returns |
|---|---|
| `@Nullable Object` | The value at the given field or `null`. |

### get

```
public @Nullable T <T> get(@NonNull String field, @NonNull Class<T> valueType)
```

Returns the value at the field, converted to a POJO, or `null` if the field or document doesn't exist.

| Parameters |
|---|---|
| `@NonNull String field` | The path to the field |
| `@NonNull Class<T> valueType` | The Java class to convert the field value to. |

| Returns |
|---|---|
| `@Nullable T` | The value at the given field or `null`. |

### get

```
public @Nullable Object get(
    @NonNull FieldPath fieldPath,
    @NonNull DocumentSnapshot.ServerTimestampBehavior serverTimestampBehavior
)
```

Returns the value at the field or `null` if the field or document doesn't exist.

| Parameters |
|---|---|
| `@NonNull FieldPath fieldPath` | The path to the field |
| `@NonNull DocumentSnapshot.ServerTimestampBehavior serverTimestampBehavior` | Configures the behavior for server timestamps that have not yet been set to their final value. |

| Returns |
|---|---|
| `@Nullable Object` | The value at the given field or `null`. |

### get

```
public @Nullable T <T> get(@NonNull FieldPath fieldPath, @NonNull Class<T> valueType)
```

Returns the value at the field, converted to a POJO, or `null` if the field or document doesn't exist.

| Parameters |
|---|---|
| `@NonNull FieldPath fieldPath` | The path to the field |
| `@NonNull Class<T> valueType` | The Java class to convert the field value to. |

| Returns |
|---|---|
| `@Nullable T` | The value at the given field or `null`. |

### get

```
public @Nullable T <T> get(
    @NonNull String field,
    @NonNull Class<T> valueType,
    @NonNull DocumentSnapshot.ServerTimestampBehavior serverTimestampBehavior
)
```

Returns the value at the field, converted to a POJO, or `null` if the field or document doesn't exist.

| Parameters |
|---|---|
| `@NonNull String field` | The path to the field |
| `@NonNull Class<T> valueType` | The Java class to convert the field value to. |
| `@NonNull DocumentSnapshot.ServerTimestampBehavior serverTimestampBehavior` | Configures the behavior for server timestamps that have not yet been set to their final value. |

| Returns |
|---|---|
| `@Nullable T` | The value at the given field or `null`. |

### get

```
public @Nullable T <T> get(
    @NonNull FieldPath fieldPath,
    @NonNull Class<T> valueType,
    @NonNull DocumentSnapshot.ServerTimestampBehavior serverTimestampBehavior
)
```

Returns the value at the field, converted to a POJO, or `null` if the field or document doesn't exist.

| Parameters |
|---|---|
| `@NonNull FieldPath fieldPath` | The path to the field |
| `@NonNull Class<T> valueType` | The Java class to convert the field value to. |
| `@NonNull DocumentSnapshot.ServerTimestampBehavior serverTimestampBehavior` | Configures the behavior for server timestamps that have not yet been set to their final value. |

| Returns |
|---|---|
| `@Nullable T` | The value at the given field or `null`. |

### getBlob

```
public @Nullable Blob getBlob(@NonNull String field)
```

Returns the value of the field as a `Blob`.

| Parameters |
|---|---|
| `@NonNull String field` | The path to the field. |

| Returns |
|---|---|
| `@Nullable Blob` | The value of the field |

| Throws |
|---|---|
| `java.lang.RuntimeException java.lang.RuntimeException` | if the value is not a `Blob`. |

### getBoolean

```
public @Nullable Boolean getBoolean(@NonNull String field)
```

Returns the value of the field as a boolean. If the value is not a boolean this will throw a runtime exception.

| Parameters |
|---|---|
| `@NonNull String field` | The path to the field. |

| Returns |
|---|---|
| `@Nullable Boolean` | The value of the field |

### getBsonObjectId

```
public @Nullable BsonObjectId getBsonObjectId(@NonNull String field)
```

Returns the value of the field as a `BsonObjectId`.

| Parameters |
|---|---|
| `@NonNull String field` | The path to the field. |

| Returns |
|---|---|
| `@Nullable BsonObjectId` | The value of the field. |

| Throws |
|---|---|
| `java.lang.RuntimeException java.lang.RuntimeException` | if the value is not a `BsonObjectId`. |

### getBsonTimestamp

```
public @Nullable BsonTimestamp getBsonTimestamp(@NonNull String field)
```

Returns the value of the field as a `BsonTimestamp`.

| Parameters |
|---|---|
| `@NonNull String field` | The path to the field. |

| Returns |
|---|---|
| `@Nullable BsonTimestamp` | The value of the field. |

| Throws |
|---|---|
| `java.lang.RuntimeException java.lang.RuntimeException` | if the value is not a `BsonTimestamp`. |

### getData

```
public @Nullable Map<String, Object> getData()
```

Returns the fields of the document as a Map or `null` if the document doesn't exist. Field values will be converted to their native Java representation.

| Returns |
|---|---|
| `@Nullable Map<String, Object>` | The fields of the document as a Map or `null` if the document doesn't exist. |

### getData

```
public @Nullable Map<String, Object> getData(
    @NonNull DocumentSnapshot.ServerTimestampBehavior serverTimestampBehavior
)
```

Returns the fields of the document as a Map or `null` if the document doesn't exist. Field values will be converted to their native Java representation.

| Parameters |
|---|---|
| `@NonNull DocumentSnapshot.ServerTimestampBehavior serverTimestampBehavior` | Configures the behavior for server timestamps that have not yet been set to their final value. |

| Returns |
|---|---|
| `@Nullable Map<String, Object>` | The fields of the document as a Map or `null` if the document doesn't exist. |

### getDate

```
public @Nullable Date getDate(@NonNull String field)
```

Returns the value of the field as a Date.

| Parameters |
|---|---|
| `@NonNull String field` | The path to the field. |

| Returns |
|---|---|
| `@Nullable Date` | The value of the field |

| Throws |
|---|---|
| `java.lang.RuntimeException java.lang.RuntimeException` | if the value is not a Date. |

### getDate

```
public @Nullable Date getDate(
    @NonNull String field,
    @NonNull DocumentSnapshot.ServerTimestampBehavior serverTimestampBehavior
)
```

Returns the value of the field as a Date.

| Parameters |
|---|---|
| `@NonNull String field` | The path to the field. |
| `@NonNull DocumentSnapshot.ServerTimestampBehavior serverTimestampBehavior` | Configures the behavior for server timestamps that have not yet been set to their final value. |

| Returns |
|---|---|
| `@Nullable Date` | The value of the field |

| Throws |
|---|---|
| `java.lang.RuntimeException java.lang.RuntimeException` | if the value is not a Date. |

### getDecimal128Value

```
public @Nullable Decimal128Value getDecimal128Value(@NonNull String field)
```

Returns the value of the field as a 128-bit decimal.

| Parameters |
|---|---|
| `@NonNull String field` | The path to the field. |

| Returns |
|---|---|
| `@Nullable Decimal128Value` | The value of the field. |

| Throws |
|---|---|
| `java.lang.RuntimeException java.lang.RuntimeException` | if the value is not a `Decimal128Value`. |

### getDocumentReference

```
public @Nullable DocumentReference getDocumentReference(@NonNull String field)
```

Returns the value of the field as a DocumentReference.

| Parameters |
|---|---|
| `@NonNull String field` | The path to the field. |

| Returns |
|---|---|
| `@Nullable DocumentReference` | The value of the field |

| Throws |
|---|---|
| `java.lang.RuntimeException java.lang.RuntimeException` | if the value is not a DocumentReference. |

### getDouble

```
public @Nullable Double getDouble(@NonNull String field)
```

Returns the value of the field as a double.

| Parameters |
|---|---|
| `@NonNull String field` | The path to the field. |

| Returns |
|---|---|
| `@Nullable Double` | The value of the field |

| Throws |
|---|---|
| `java.lang.RuntimeException java.lang.RuntimeException` | if the value is not a number. |

### getGeoPoint

```
public @Nullable GeoPoint getGeoPoint(@NonNull String field)
```

Returns the value of the field as a GeoPoint.

| Parameters |
|---|---|
| `@NonNull String field` | The path to the field. |

| Returns |
|---|---|
| `@Nullable GeoPoint` | The value of the field |

| Throws |
|---|---|
| `java.lang.RuntimeException java.lang.RuntimeException` | if the value is not a GeoPoint. |

### getId

```
public @NonNull String getId()
```

| Returns |
|---|---|
| `@NonNull String` | The id of the document. |

### getInt32Value

```
public @Nullable Int32Value getInt32Value(@NonNull String field)
```

Returns the value of the field as a 32-bit integer.

| Parameters |
|---|---|
| `@NonNull String field` | The path to the field. |

| Returns |
|---|---|
| `@Nullable Int32Value` | The value of the field. |

| Throws |
|---|---|
| `java.lang.RuntimeException java.lang.RuntimeException` | if the value is not a `Int32Value`. |

### getLong

```
public @Nullable Long getLong(@NonNull String field)
```

Returns the value of the field as a long.

| Parameters |
|---|---|
| `@NonNull String field` | The path to the field. |

| Returns |
|---|---|
| `@Nullable Long` | The value of the field |

| Throws |
|---|---|
| `java.lang.RuntimeException java.lang.RuntimeException` | if the value is not a number. |

### getMaxKey

```
public @Nullable MaxKey getMaxKey(@NonNull String field)
```

Returns the value of the field as a `MaxKey`.

| Parameters |
|---|---|
| `@NonNull String field` | The path to the field. |

| Returns |
|---|---|
| `@Nullable MaxKey` | The value of the field. |

| Throws |
|---|---|
| `java.lang.RuntimeException java.lang.RuntimeException` | if the value is not a `MaxKey`. |

### getMetadata

```
public @NonNull SnapshotMetadata getMetadata()
```

| Returns |
|---|---|
| `@NonNull SnapshotMetadata` | The metadata for this document snapshot. |

### getMinKey

```
public @Nullable MinKey getMinKey(@NonNull String field)
```

Returns the value of the field as a `MinKey`.

| Parameters |
|---|---|
| `@NonNull String field` | The path to the field. |

| Returns |
|---|---|
| `@Nullable MinKey` | The value of the field. |

| Throws |
|---|---|
| `java.lang.RuntimeException java.lang.RuntimeException` | if the value is not a `MinKey`. |

### getReference

```
public @NonNull DocumentReference getReference()
```

Gets the reference to the document.

| Returns |
|---|---|
| `@NonNull DocumentReference` | The reference to the document. |

### getRegexValue

```
public @Nullable RegexValue getRegexValue(@NonNull String field)
```

Returns the value of the field as a `RegexValue`.

| Parameters |
|---|---|
| `@NonNull String field` | The path to the field. |

| Returns |
|---|---|
| `@Nullable RegexValue` | The value of the field. |

| Throws |
|---|---|
| `java.lang.RuntimeException java.lang.RuntimeException` | if the value is not a `RegexValue`. |

### getString

```
public @Nullable String getString(@NonNull String field)
```

Returns the value of the field as a String.

| Parameters |
|---|---|
| `@NonNull String field` | The path to the field. |

| Returns |
|---|---|
| `@Nullable String` | The value of the field |

| Throws |
|---|---|
| `java.lang.RuntimeException java.lang.RuntimeException` | if the value is not a String. |

### getTimestamp

```
public @Nullable Timestamp getTimestamp(@NonNull String field)
```

Returns the value of the field as a `com.google.firebase.Timestamp`.

| Parameters |
|---|---|
| `@NonNull String field` | The path to the field. |

| Returns |
|---|---|
| `@Nullable Timestamp` | The value of the field |

| Throws |
|---|---|
| `java.lang.RuntimeException java.lang.RuntimeException` | if this is not a timestamp field. |

### getTimestamp

```
public @Nullable Timestamp getTimestamp(
    @NonNull String field,
    @NonNull DocumentSnapshot.ServerTimestampBehavior serverTimestampBehavior
)
```

Returns the value of the field as a `com.google.firebase.Timestamp`.

| Parameters |
|---|---|
| `@NonNull String field` | The path to the field. |
| `@NonNull DocumentSnapshot.ServerTimestampBehavior serverTimestampBehavior` | Configures the behavior for server timestamps that have not yet been set to their final value. |

| Returns |
|---|---|
| `@Nullable Timestamp` | The value of the field |

| Throws |
|---|---|
| `java.lang.RuntimeException java.lang.RuntimeException` | if the value is not a timestamp field. |

### getVectorValue

```
public @Nullable VectorValue getVectorValue(@NonNull String field)
```

Returns the value of the field as a `VectorValue` or `null` if the field does not exist in the document.

| Parameters |
|---|---|
| `@NonNull String field` | The path to the field. |

| Returns |
|---|---|
| `@Nullable VectorValue` | The value of the field. |

| Throws |
|---|---|
| `java.lang.RuntimeException java.lang.RuntimeException` | if the value is not a `VectorValue`. |

### hashCode

```
public int hashCode()
```

### toObject

```
public @Nullable T <T> toObject(@NonNull Class<T> valueType)
```

Returns the contents of the document converted to a POJO or `null` if the document doesn't exist.

| Parameters |
|---|---|
| `@NonNull Class<T> valueType` | The Java class to create |

| Returns |
|---|---|
| `@Nullable T` | The contents of the document in an object of type T or `null` if the document doesn't exist. |

### toObject

```
public @Nullable T <T> toObject(
    @NonNull Class<T> valueType,
    @NonNull DocumentSnapshot.ServerTimestampBehavior serverTimestampBehavior
)
```

Returns the contents of the document converted to a POJO or `null` if the document doesn't exist.

| Parameters |
|---|---|
| `@NonNull Class<T> valueType` | The Java class to create |
| `@NonNull DocumentSnapshot.ServerTimestampBehavior serverTimestampBehavior` | Configures the behavior for server timestamps that have not yet been set to their final value. |

| Returns |
|---|---|
| `@Nullable T` | The contents of the document in an object of type T or `null` if the document doesn't exist. |

### toString

```
public @NonNull String toString()
```

## Extension functions

### FirestoreKt.getField

```
public final T <T extends Object> FirestoreKt.getField(
    @NonNull DocumentSnapshot receiver,
    @NonNull String field
)
```

Returns the value at the field, converted to a POJO, or null if the field or document doesn't exist.

| Parameters |
|---|---|
| `<T extends Object>` | The type to convert the field value to. |
| `@NonNull String field` | The path to the field. |

| Returns |
|---|---|
| `T` | The value at the given field or null. |

### FirestoreKt.getField

```
public final T <T extends Object> FirestoreKt.getField(
    @NonNull DocumentSnapshot receiver,
    @NonNull String field,
    @NonNull DocumentSnapshot.ServerTimestampBehavior serverTimestampBehavior
)
```

Returns the value at the field, converted to a POJO, or null if the field or document doesn't exist.

| Parameters |
|---|---|
| `<T extends Object>` | The type to convert the field value to. |
| `@NonNull String field` | The path to the field. |
| `@NonNull DocumentSnapshot.ServerTimestampBehavior serverTimestampBehavior` | Configures the behavior for server timestamps that have not yet ``` been set to their final value. @return ``` The value at the given field or null. |

### FirestoreKt.getField

```
public final T <T extends Object> FirestoreKt.getField(
    @NonNull DocumentSnapshot receiver,
    @NonNull FieldPath fieldPath
)
```

Returns the value at the field, converted to a POJO, or null if the field or document doesn't exist.

| Parameters |
|---|---|
| `<T extends Object>` | The type to convert the field value to. |
| `@NonNull FieldPath fieldPath` | The path to the field. |

| Returns |
|---|---|
| `T` | The value at the given field or null. |

### FirestoreKt.getField

```
public final T <T extends Object> FirestoreKt.getField(
    @NonNull DocumentSnapshot receiver,
    @NonNull FieldPath fieldPath,
    @NonNull DocumentSnapshot.ServerTimestampBehavior serverTimestampBehavior
)
```

Returns the value at the field, converted to a POJO, or null if the field or document doesn't exist.

| Parameters |
|---|---|
| `<T extends Object>` | The type to convert the field value to. |
| `@NonNull FieldPath fieldPath` | The path to the field. |
| `@NonNull DocumentSnapshot.ServerTimestampBehavior serverTimestampBehavior` | Configures the behavior for server timestamps that have not yet ``` been set to their final value. @return ``` The value at the given field or null. |

### FirestoreKt.toObject

```
public final T <T extends Object> FirestoreKt.toObject(@NonNull DocumentSnapshot receiver)
```

Returns the contents of the document converted to a POJO or null if the document doesn't exist.

| Parameters |
|---|---|
| `<T extends Object>` | The type of the object to create. |

| Returns |
|---|---|
| `T` | The contents of the document in an object of type T or null if the document doesn't ``` exist. ``` |

### FirestoreKt.toObject

```
public final T <T extends Object> FirestoreKt.toObject(
    @NonNull DocumentSnapshot receiver,
    @NonNull DocumentSnapshot.ServerTimestampBehavior serverTimestampBehavior
)
```

Returns the contents of the document converted to a POJO or null if the document doesn't exist.

| Parameters |
|---|---|
| `<T extends Object>` | The type of the object to create. |
| `@NonNull DocumentSnapshot.ServerTimestampBehavior serverTimestampBehavior` | Configures the behavior for server timestamps that have not yet ``` been set to their final value. @return ``` The contents of the document in an object of type T or null if the document doesn't ``` exist. ``` |