Hi folks - brand new to retool and excited about the capabilities already. I'm testing some capabilities with a dummy project in Firestore.
Following the guide to create a table with editable fields for a specific collection. My collection is quite simple:
things/
Created At Timestamp
name
user id
When I edit the name field using steps in the guide to update a single recordin the table, it appears to be writing back the updated name (nice!) but it's also adding in the following to the document (when viewing in Firebase Console):
a map called __metadata that has an array called segments
on index [0] it has the collection name: things
on index [1] it repeats the document's id
a field called _id (duplicates the documents id)
Curiuous what these fields are and how I could keep my documents cleaner by not writing the back to the document each time I edit a single field.
Two of Retool's Firestore queries will include this metadata, Query Firestore and Query Collection Group. Are you referencing the queried collection object in your update statement? You should be able to see this in the model browser:
So if you're referencing this in your update statement, the metadata field will also be included:
Thank you very much for the detailed reply. Appologies, but I may need a little hand holding here. Both of your solutions make sense, but I'm struggling with how exactly to implement.
Here's where I have in my updateRecord query (this is using an editable table field where I have a single field called "name" that I want to be editable. (This did not seem to work).
Another question/idea is perhaps I could use an "Update" method for each object instead of replacing the entire object? That way I only update the single "name" field? Is that also possible?
Thank you again for the detailed and helpful response and warm welcome!
@json2001 were you able to figure it out? RE: the transformer, you’ll want to create a separate standalone transformer (more on this difference here), and then reference {{ transformer.value}} in your Firestore insert query.
I was able to get this working how I expected by following the link to the guide in forums I posted previously. So I didn’t get into the transforms this round , rather had the JS query omit those fields from the set.