UnnestStage

class UnnestStage : Stage


Takes a specified array from the input documents and outputs a document for each element with the element stored in a field with name specified by the alias.

Summary

Public companion functions

UnnestStage
withField(arrayWithAlias: Selectable)

Creates UnnestStage with input array and alias specified.

UnnestStage
withField(arrayField: String, alias: String)

Creates UnnestStage with input array and alias specified.

Public functions

open operator Boolean
equals(other: Any?)
open Int
UnnestStage
withIndexField(indexField: String)

Adds an index field to the output documents.

Inherited functions

From com.google.firebase.firestore.pipeline.Stage
UnnestStage
UnnestStage
withOption(key: String, value: Boolean)

Specify named Boolean parameter

UnnestStage
withOption(key: String, value: Double)

Specify named Double parameter

UnnestStage
withOption(key: String, value: Field)

Specify named Field parameter

UnnestStage
withOption(key: String, value: Long)

Specify named Long parameter

UnnestStage
withOption(key: String, value: String)

Specify named String parameter

Public companion functions

withField

fun withField(arrayWithAlias: Selectable): UnnestStage

Creates UnnestStage with input array and alias specified.

For each document emitted by the prior stage, this stage will emit zero or more augmented documents. The input array is found in parameter arrayWithAlias, which can be an Expression with an alias specified via Expression.alias, or a Field that can also have alias specified. For each element of the input array, an augmented document will be produced. The element of input array will be stored in a field with name specified by the alias of the arrayWithAlias parameter. If the arrayWithAlias is a Field with no alias, then the original array field will be replaced with the individual element.

Parameters
arrayWithAlias: Selectable

The input array with field alias to store output element of array.

Returns
UnnestStage

UnnestStage with input array and alias specified.

withField

fun withField(arrayField: String, alias: String): UnnestStage

Creates UnnestStage with input array and alias specified.

For each document emitted by the prior stage, this stage will emit zero or more augmented documents. The input array found in the previous stage document field specified by the arrayField parameter, will for each element of the input array produce an augmented document. The element of the input array will be stored in a field with name specified by alias parameter on the augmented document.

Returns
UnnestStage

UnnestStage with input array and alias specified.

Public functions

equals

open operator fun equals(other: Any?): Boolean

hashCode

open fun hashCode(): Int

withIndexField

fun withIndexField(indexField: String): UnnestStage

Adds an index field to the output documents.

A field with the name specified in indexField will be added to each output document. The value of this field is a numeric value that corresponds to the array index of the element from the input array.

Parameters
indexField: String

The name of the index field.

Returns
UnnestStage

A new UnnestStage that includes the specified index field.