Add an item in array firebase

Hi, I`m trying to add one item in array using firebase, but when I use an add function it add an item in index 0, but I need that add one new item in index 1, then 2, and after all…

for examplo here, I have 3 itens, but I need to add the 4th item when the webhook get some uptade…

grateful in advance

Welcome to the Make community!

To progressively add to a field containing an array, you first need to fetch the existing items from the array.

Is there a module that you can use to fetch the items from the array?

If you need further assistance, please provide the following:

1. Screenshots of module fields and filters

Please share screenshots of relevant module fields and filters in question? It would really help other community members to see what you’re looking at.

You can upload images here using the Upload icon in the text editor:
Screenshot_2023-10-07_111039

2. Scenario blueprint

Please export the scenario blueprint file to allow others to view the mappings and settings. At the bottom of the scenario editor, you can click on the three dots to find the Export Blueprint menu item.

Screenshot_2023-08-24_230826
(Note: Exporting your scenario will not include private information or keys to your connections)

Uploading it here will look like this:

blueprint.json (12.3 KB)

3. And most importantly, Input/Output bundles

Please provide the input and output bundles of the modules by running the scenario (or get from the scenario History tab), then click the white speech bubble on the top-right of each module and select “Download input/output bundles”.
Screenshot_2023-10-06_141025

A.

Save each bundle contents in your text editor as a bundle.txt file, and upload it here into this discussion thread.

Uploading them here will look like this:

module-1-input-bundle.txt (12.3 KB)
module-1-output-bundle.txt (12.3 KB)

B.

If you are unable to upload files on this forum, alternatively you can paste the formatted bundles in this manner:

  • Either add three backticks ``` before and after the code, like this:

    ```
    input/output bundle content goes here
    ```

  • Or use the format code button in the editor:
    Screenshot_2023-10-02_191027

Providing the input/output bundles will allow others to replicate what is going on in the scenario even if they do not use the external service.

Following these steps will allow others to assist you here. Thanks!

2 Likes

I get the datas from firebase query module…
input of module

[
    {
        "from": {
            "collectionId": "saldoLiberar"
        },
        "path": "/",
        "limit": 100,
        "select": {},
        "filters": [
            [
                {
                    "a": "uid",
                    "b": "vbygv9f8uEUTDWQWkQIcWCeHwfo2",
                    "o": "fieldFilter::EQUAL::stringValue"
                }
            ]
        ],
        "input_type": "select",
        "project_id": "nesh6-test-686a4",
        "query_type": "builder"
    }
]

output of module

[
    {
        "name": "projects/nesh6-test-686a4/databases/(default)/documents/saldoLiberar/vbygv9f8uEUTDWQWkQIcWCeHwfo2",
        "fields": {
            "uid": "vbygv9f8uEUTDWQWkQIcWCeHwfo2",
            "saldoALiberar": 2,
            "mesAnterior": "2",
            "limiteSaque": 2800,
            "saldoLiberado": 250,
            "saldoLiberarD": [
                0
            ],
            "dataLiberar": [
                "2024-02-18T03:00:00.776Z"
            ],
            "dataLibera": [
                565445
            ]
        },
        "readTime": "2024-02-18T10:08:22.126064Z",
        "createTime": "2024-02-10T00:25:29.668Z",
        "updateTime": "2024-02-18T02:49:12.177Z",
        "__IMTLENGTH__": 1,
        "__IMTINDEX__": 1
    }
]