Back

Query help

  • 0
  • Databases
  • Flutter
Ireneus
12 Feb, 2024, 17:15

I have an attribute string array in a collection and lets say it contains Ids how can i check between 2 documents from that collection where they have same ids example doc 1 attribute "ids" [1423] [123] doc 2 [0005] [123] how would i find the mutual part wich is [123]

TL;DR
Summary: The developer is asking for help on how to find the common elements between two documents in a collection, specifically for an attribute that is a string array containing IDs. Solution: To find the mutual part (common elements) between two documents in a collection, both containing a string array attribute with IDs, you can use the following approach: 1. Retrieve both documents from the collection. 2. Access the "ids" attribute in each document. 3. Convert the string arrays into sets for easy comparison. 4. Use the intersection operation to find the common elements between the two sets. 5. Convert the resulting set back to an array if
Ireneus
12 Feb, 2024, 17:44

i guess i can do this by selecting the 2 documents and then checking client side

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