
I have a collection that has attribute named ids of type arrays , in ids some id will be store that will belong to it , i want to query this collection such that only that documents fetch in which any specific id containes in ids attribute , i will paas this id in input , how will i do that in react.

You can achieve that by creating another field named search
and add fullText
index to it

Then add all the ID's to that field seperate by space.

If I understood well you need to create a key index and use Query.equal('ids' ['id1', 'id2', '...'])

@Binyamin Why you prefer fullText? 🤔

Because I though he also liked to perform a search to find only one ID

If the match looking is for all the IDs together then your solution is the right one.

Yes, the description is not very clear, lets wait until he clarify what he is looking for

"title": String ,
"ids": Array[String],
amount: Int
)```

so when i pass any id in function , all document that contains this id in ids array should get

const queries = [Query.equal('ids', [...])]
const response = await databases.listDocuments('DATABASE_ID', 'COLLECTION_ID', queries);
This is what you should do with the JS SDK

its not working

try {
const queries = [Query.equal('ids', [id])]
return database.listDocuments(databaseID,
collectionId,
queries
);
} catch (e) {
console.error(e.message);
}
};```

Do you get any error, or you just get an empty array?

Does your collection or document have the correct permission?

i got empty array

My collection has proper permission , and indexing also

Please check this, issue: https://github.com/appwrite/appwrite/issues/2838

it seems like is not officially supported however the last comment says you can use Query.search
Recommended threads
- Sharing cookies
Hi, I’m using Appwrite Cloud, and I have a setup where my Appwrite backend is hosted on a subdomain (e.g., api.example.com), while my frontend (Next.js app) and...
- Organization not exists anymore
Hello! We have a problem with a cloud database. We are on the Free plan, but after a refresh the site wants me to create a new organisation, and I not see the c...
- JSON and Object Support in Collection do...
I am working with Next.Js and Appwrite Cloud, I am relatively New to Appwrite but i have noticed there is no direct support of JSON and Object support in attrib...
