> For the complete documentation index, see [llms.txt](https://estare.gitbook.io/firebase-auth-firestore-and-storage-plugin/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://estare.gitbook.io/firebase-auth-firestore-and-storage-plugin/plugin-elements/firestore-data-extractor.md).

# Firestore Data Extractor

The Firestore Data Extractor element can be used to get fields from the JSON structure of documents fetched from Firestore. It processes a single document in order to get it's fields and translate them in data types the Bubble can comprehend.&#x20;

<div align="left"><figure><img src="/files/s1kLsO14UMtIUegkSGp6" alt=""><figcaption></figcaption></figure></div>

***

## <mark style="color:blue;">Settings</mark>

### Document Data

Here you must specify the id (or name) of the collection of document in Firestore where you chose to store user data. The plugin will fetch data from the document in that collection that has the same ID as the current authenticated user.

### Fields (1, 2, 3, ...)

The name or path (in dot notation) of the field you want to extract from the document.

For instance, if you you want to extract the content of the field "description" on the document, that's the name you should put on this setting.

<figure><img src="/files/bvEYOklYMHJyY2XqdpJH" alt=""><figcaption></figcaption></figure>

If the field is of type Map, you can use "dot notation" to extract the value of a specific key on the map. In the example below, a field of name "links" has two keys, "pt-br" and "en-us". To get the value from the "pt-br", the Field would be "links.pt-br".

<div align="left"><figure><img src="/files/7OWW1Gvh6Cw5HFfrJVnD" alt=""><figcaption></figcaption></figure> <figure><img src="/files/0VwYuI20aSKFbL2WI1Vj" alt=""><figcaption></figcaption></figure> <figure><img src="/files/2RV8n8nLjRwuhj22kYAn" alt=""><figcaption></figcaption></figure></div>

If you don't specify a path and only provide "links" as a path, the entire Map JSON structure can be used as a text. This JSON text can be used in another Data Extractor to get specific fields from it too.

<div align="left"><figure><img src="/files/XoDoFqdEhXVfVdgesUma" alt=""><figcaption></figcaption></figure> <figure><img src="/files/hN5xlyBzpMHLNE7DZpfD" alt=""><figcaption></figcaption></figure></div>

### Field List (1, 2, 3, ...)

The name of the array/list field you want to extract from the document. The generated state will be turned into a Bubble list of values.

<div align="left"><figure><img src="/files/uKoqMCQzXA07Qad45yAR" alt=""><figcaption></figcaption></figure> <figure><img src="/files/QrVeAEQSdTf1rK7yCyfX" alt=""><figcaption></figcaption></figure> <figure><img src="/files/WI294sD55mRM6Bug8nUt" alt=""><figcaption></figcaption></figure></div>

If the list is a list of "Map" types, you can feed them to a [Firestore Data Processor](/firebase-auth-firestore-and-storage-plugin/plugin-elements/firestore-data-processor.md), to treat them as a list of documents and extract data further.

### Field Types (1, 2, 3, ...)

Choose between the Bubble's basic data types, so that the value of the Field you're extracting can be translated to it. This can end up in error's, like if you try to provide a text to a field you defined as number, so be careful with what you choose and check your browser's console (press "F12") to look for errors.

Some data types on Firestore must be treated as texts on Bubble if you want to display them or use them elsewhere, like "Maps" or "References".

{% hint style="info" %}
"Reference" types will be displayed as a text showing the path to the document, like so: collection\_name/document\_id&#x20;

(e.g. tasks/6KXLqGVsvGdytOI5pB8F or users/6n6tlWXTDwUp3f7yQ95mpITUUmZ2)
{% endhint %}

<div align="left"><figure><img src="/files/tQvAVufzlW00K00G21Ex" alt=""><figcaption></figcaption></figure> <figure><img src="/files/DJXEt3lBxd5mbO7ojfaq" alt=""><figcaption></figcaption></figure></div>

***

## <mark style="color:blue;">States and Values</mark>

The Data Extractor provides, for each field you get, a corresponding state containing it's value. It also provides some other useful data, like the originating document id, for instance.

<div align="left"><figure><img src="/files/FVDG3SbsxMBy8cOoFUMF" alt=""><figcaption></figcaption></figure></div>

### Document ID

The ID of the processed document. This ID is available in the JSON structure under the key "\_id", but is extracted by default.

### Data (w/ schema)

The JSON data, interpreted through the "data schema" you define on an API Connector and provide to the element. See how to configure this on the [Data Schemas](/firebase-auth-firestore-and-storage-plugin/plugin-elements/data-schemas.md) documentation.

### Field (1, 2, 3, ...)

The value extracted from the field, translated to the Field Type you defined for it.

### Field List (1, 2, 3, ...)

A list of values extracted from an array field on the document, each entry translated to the Field Type you defined for it.

### Error message

Stores the last error message on the element, if there was any.

### Data is Ready

Turns to "yes" when all the element's states are done being filled, an "no" when they are being filled.

Although this operations are fast, the fact the they are filled in order and not at the same time may lead to issues, that's why this state was created.

### Keys

The list of paths on the provided data. It gives you all the possible Fields you can extract from the data you provided.&#x20;

If the document has a Field of type "Reference" that points to another document, this list can become long, as the reference JSON object has lots or properties that do not interest us.

## <mark style="color:blue;">Events</mark>

<div align="left"><figure><img src="/files/wuJEEigVIAKe7UgYqTip" alt=""><figcaption></figcaption></figure></div>

### Data ready or changed

Triggered when the data from the extractor is all loaded and ready to be used.
