Thomas
Thomas3mo ago

firebase map instead of array saved

Hello everyone, I'm facing an issue with a node in my BuildShip workflow that's supposed to save an array of strings to a Firestore document. Instead of saving the array, it ends up saving a map. Here's a breakdown of the situation: Context: I'm using the @buildship/create-firestore-document node to create or update a document in a Firestore collection. The document should contain an array field named searchTermProxies. Current Configuration:
[ { "_libRef": { "integrity": "v3:c86b19093b8beaf454a6d4cc9f2f577a", "libNodeRefId": "@buildship/create-firestore-document", "isDirty": false, "libType": "public", "src": "https://storage.googleapis.com/buildship-app-us-central1/publicLib/nodes/@buildship/create-firestore-document/1.3.1/build.cjs", "version": "1.3.1" }, "id": "db65dd0f-6b7d-4aeb-8d14-efb43f7ba4c0", "label": "Create Document", "type": "script", "onFail": null, "values": { "projectId": { "type": "text", "expression": "projectEnv["firebase project id"]" }, "merge": true, "id": { "expression": "${ctx[\"root\"][\"request\"][\"body\"][\"listingId\"]}", "hasErrors": false, "type": "javascript" }, "data": { "expression": "{\n "searchTermProxies": Array.isArray(ctx["root"]["10f889b1-0ecf-44e6-a639-41496d1378d0"]["98713c80-5eba-455f-af1c-25ab600c942b"]["d7eed1c8-814b-4601-a7ab-c9464bfb0433"]) ? ctx["root"]["10f889b1-0ecf-44e6-a639-41496d1378d0"]["98713c80-5eba-455f-af1c-25ab600c942b"]["d7eed1c8-814b-4601-a7ab-c9464bfb0433"] : []\n}", "type": "javascript", "hasErrors": false }, "collectionName": "listings" } } ]
Any guidance or help to resolve this issue would be greatly appreciated. Thanks in advance!
Solution:
@Thomas Use the "Add Object to Firestore Array" node after you create document to update the specific field to type array. It should then update the field type to array, as the current firestore create doc converts the data to the preferred firestore type. This should solve your issue.
No description
Jump to solution
11 Replies
AI Support
AI Support3mo ago
BuildShip AI Support - Crafting Solution, (Avg response time: ~2 minutes 🙂)
AI Support
AI Support3mo ago
Sorry, there was an error processing your request. Please try again in ~1 minute
Gaurav Chadha
Gaurav Chadha3mo ago
Hi @Thomas Can you share the sample data format which you are trying to create doc.
AI Support
AI Support3mo ago
To share the sample data format for creating a document in BuildShip, please refer to the documentation for the specific node or workflow you are using. If you need more detailed information or examples, you can submit your query via the in-app support button for personalized assistance. For general guidance on data formats and nodes, you might find the following documentation useful: BuildShip Documentation. If you have any further questions, please feel free to reach out.
Thomas
Thomas3mo ago
sure, this is the array input: [ "proxy_1" ]
Thomas
Thomas3mo ago
This my firebase structure
No description
AI Support
AI Support3mo ago
Sorry, there was an error processing your request. Please try again in ~1 minute For assistance with Firebase and its integration with BuildShip, please submit your query via the in-app support button. This will allow our support team to provide you with the most accurate and detailed guidance based on your specific needs.
Thomas
Thomas3mo ago
This is what I get
No description
AI Support
AI Support3mo ago
Sure, I'd be happy to assist! Could you please provide more details about the issue you're encountering? If it's related to a specific node or functionality, mentioning that would help me provide a more targeted response. If you need immediate assistance, you can also submit your query via the in-app support button.
Solution
Gaurav Chadha
Gaurav Chadha3mo ago
@Thomas Use the "Add Object to Firestore Array" node after you create document to update the specific field to type array. It should then update the field type to array, as the current firestore create doc converts the data to the preferred firestore type. This should solve your issue.
No description
Thomas
Thomas3mo ago
omg! amazing, 1000 thanks!