Back

[CLOSED] How to upload a new element for specific Attribute

  • 1
  • Databases
  • Flutter
  • Cloud
Mosh Ontong
7 Aug, 2023, 16:30

We do know that we can set the value for this attribute can be an array. In instance, we have List of String with the name of followers, and then currently in this specific document it have this value ['Mosh','Josh']. Now what if in client side I want to add another element we can call it 'Tosh' as a new followers. So what function or how can we do this to upload this new element? Hence, if we successuly update the document then the followers' attribute we will have ['Mosh','Josh','Tosh'].

TL;DR
The user is looking for a way to upload a new element for a specific attribute in the Appwrite platform. Currently, Appwrite does not have any array operations implemented. However, there is a workaround suggested by providing the full updated value or using a merge operation. The merge operation can be achieved by using the `set` method with the `{ merge: true }` option in Firebase Firestore. It is recommended to track the progress of this feature request on the Appwrite GitHub repository. For now, the solution is to replace the attribute value with the updated array or use a merge operation.
Mosh Ontong
7 Aug, 2023, 17:29
Mosh Ontong
7 Aug, 2023, 17:30

they have arrayUnion method does appwrite have something like this?

Mosh Ontong
7 Aug, 2023, 17:31

firebase.firestore() .collection('proprietary') .doc(docID) .set( { sharedWith: [{ who: "third@test.com", when: new Date() }] }, { merge: true } )

Mosh Ontong
7 Aug, 2023, 17:31

or something like merge

Drake
7 Aug, 2023, 21:25

we don't have any array operations yet. You might want to πŸ‘πŸΌ this issue: https://github.com/appwrite/appwrite/issues/2531

For now, you'll have to replace the attribute with the full updated value

joeyouss
8 Aug, 2023, 09:48

[CLOSED] How to upload a new element for specific Attribute

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more