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
- Invalid document structure: missing requ...
I just pick up my code that's working a week ago, and now I got this error: ``` code: 400, type: 'document_invalid_structure', response: { message: 'Inv...
- custom domain with CloudFlare
Hi all, it seems that CloudFlare has blocked cross-domain CNAME link which made my app hostname which is in CloudFlare, unable to create a CNAME pointing to clo...
- Custom emails
What happen if I use a third party email provider to customize my emails and my plan run out of emails/month? Appwrite emails are used as fallback sending emai...