Firestore Create/Update upsert into subcollection

I’m new to n8n… what am I doing wrong here? Is this a bug or not supported?

When my workflow executes a document is created in my subcollection (users/{user-id}/videoAskQuestions) with an id of undefined even though it appears as though it should work see screenshots:

this is in Firestore:

Hi @benneic, welcome to the community! I hope you’re having a good day thus far?

In the update key field you’d define the name of the field which holds the id of the document to update (or create). So in your example, n8n would use a field with a name of 02266c88... which does not exist (and thus would have an undefined value).

Instead you’d need the name of the field with the respective value:

Example workflow

I hope this makes sense and helps! Let me know if you still run into any trouble afterwards.

Awesome, that works now! And obvious what *Update Key * means now that I’ve had a sleep and come back to it…

Update Key = “Provide the key that corresponds to the value in the input used to identify the document for create and update operations.”

Cheers!

1 Like

What if I want to update the value of a document’s key value to something dynamic that is not held by that key? What is the format that n8n expression expects?

Hi @roon, welcome to the community! This is a rather old thread that has been marked as solved two years ago and n8n has changed a lot since.

Perhaps you can open a new forum topic, and provide all details required to understand the problem you are looking to solve? In particular, your current document structure, the JSON data you have in n8n, and the new document structure you’d like to see after running your Firestore node.

For general information on expressions you can also check out our docs.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.