I've been using Retool lately to create an admin panel and I think there are some important features missing in firestore integration.
There are no:
firebase.firestore.FieldValue.arrayUnion
firebase.firestore.FieldValue.arrayRemove
I know I can just fetch the latest item and add the items to it, but there is a huge concurrency problem: what if, while I am changing it another user changes it? What is the final version?
Hey @cdedreuille! We don’t have native support for this quite yet, so your best bet is to pass a fully updated array in your query. So basically take the current value of the array, push new values to it via JS, and then pass that updated array to overwrite the existing one. Does that make sense? (We’re working on building a raw query editor so you’ll be able to access the SDK directly!)
Hey @gzaccaroni! I'm sorry that you've run into issues here
We do support most basic (and some advanced) operations for querying Firestore, so I'm not sure it's fair to say that it's not "real" – but we certainly could do a better job of supporting more specific array operations. We've just been focused on more of the core experience lately (see our weekly changelog) and Firebase has taken a bit of a back seat. It's definitely something we're hoping to improve in the future!
If you'd like access to the beta for the raw query editor, just shoot me an email (justin at retool) and we can get you set up.
What we're also missing are document updates over the dot notation (Official Firebase Docs). This is quite dangerous right now on retool when you experience the missing support for the first time. The operation will just not fail and create an additional property on the document and mess up the data structure.
Using these features are best-practices of working with Firestore. Right now it can be solved by creating an http endpoint, implemented the operations there and call it over retool.
Because retool is all about helping us provide secure admin backends quickly it'd be awesome when you support these operations as well!
@justin When the beta program is still open and we can use the dot annotation updates with it, I'd love to have access as well.
I will second the vote for supporting serverTimeStamp. It's very useful for some applications, and as long as you don't need to query on this field, it's there for free.