Help for reading and writing dataset to Firestore

I need to read a set of records from Firestore and change a particular field from all those records.

For reading I’ve already created a node using a query, but I can’t change all the records at once.

Could someone guide me?

Thank you very much in advance.

Hi @Jovaldo_Savian, the Firestore node should update multiple items without having to implement any additional logic. E.g. you pass 10 items to it, it would update 10 items.

Here is an example workflow showing this:

Example Workflow
{
  "nodes": [
    {
      "parameters": {},
      "name": "Start",
      "type": "n8n-nodes-base.start",
      "typeVersion": 1,
      "position": [
        240,
        300
      ]
    },
    {
      "parameters": {
        "operation": "upsert",
        "projectId": "mutedjam-app-n8n-cloud",
        "collection": "my_collection",
        "updateKey": "id",
        "columns": "message"
      },
      "name": "Google Cloud Firestore",
      "type": "n8n-nodes-base.googleFirebaseCloudFirestore",
      "typeVersion": 1,
      "position": [
        680,
        300
      ],
      "credentials": {
        "googleFirebaseCloudFirestoreOAuth2Api": {
          "id": "36",
          "name": "Google Firebase Cloud Firestore account"
        }
      }
    },
    {
      "parameters": {
        "functionCode": "let example = [];\n\nfor (let step = 0; step < 10; step++) {\n  example.push({\n    json: {\n      message: new Date().toISOString(),\n      id: (+new Date).toString(36).slice(-5) + Math.random().toString(36).substr(2, 5)\n    }\n  })\n\n}\n\nreturn example;"
      },
      "name": "Generate Example Data",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        460,
        300
      ]
    }
  ],
  "connections": {
    "Start": {
      "main": [
        [
          {
            "node": "Generate Example Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Example Data": {
      "main": [
        [
          {
            "node": "Google Cloud Firestore",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

If you’re having any trouble with this, it would be great if you could share the data you’re passing on the Firestode node as well as your node settings itself so we can take a quick look at what’s happening.

thank you, i will take a test