Back

How to update string[] property using updateDocument? Does updateDocument supports Query property.

  • 0
  • Databases
  • Web
ICE
14 Apr, 2024, 22:43

In the Collection i have addressDetails as string[], basically I want to append the new address into addressDetails[]

let stringAddress=JSON.stringify(data);

TypeScript
this.database.updateDocument(this.DB_ID, this.USERACCOUNT_ID, '6604b6f2bd685e13bb9a', {"addressDetails": stringAddress}).then(result =>{
  console.log('Address Updated');
})

also How can i edit the existing addressDetails :string[] attribute?

Or should I use new collection for Address and use relationship between UserAccount and Address Collection?

TL;DR
- Developers want to update a string[] property in a document using updateDocument. - They are looking to append a new address to the existing addressDetails[] array. - Unsure if updateDocument supports a Query property. - There is a suggestion to create a new collection for Addresses and establish a relationship between UserAccount and Address Collection. Solution: To update the existing addressDetails attribute, you can retrieve the existing array, manipulate it by adding the new address, and then update the document with the modified array.
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