AppwriteException: Invalid query: Cannot query search on attribute "tags" because it is an array.
why? because everything is working fine. how to solve it because my website is in the production
this is my code
async searchResultsBytags(tag: string) {
try {
return await this.databases.listDocuments(
conf.appwriteDatabaseId,
conf.appwriteCollectionId,
[
Query.orderDesc("$createdAt"),
Query.select(["title","$id"]),
Query.equal("tags", "${tag}"
),
Query.equal("status", "Approved"), // Add this condition
Query.limit(8),
]
);
} catch (error) {
console.error("appwrite service :: CategoryBegginersInfo 3 :: ", error);
return false;
}
}
Hello there 👋 This may be coming from our end, allow me few minutes to check it please 🙏
Can you please do me a favour? If you visit Appwrite Console and look at attributes
tab of your collection, what type&length is the tags
attribute? Also, can you please provide me some sample value of any of your documents? To better imagine the situation
Btw, it's best to use 3 back ticks with multi-line code. See https://www.markdownguide.org/extended-syntax/#syntax-highlighting
Where's the search query? 🧐
I think it's equal
on array attributes that also cause trouble. Need to verify
length is 255
Thank you so much for confirming 🙏 Let's see if this fixes it:
- In your App, upgrade to latest Appwrite SDK. For web, that is
npm install appwrite@14.0.1
- Switch from:
Query.equal("tags"...
to:
Query.contains("tags", tag)
okay let me check
thanks a lot . it worked
Amazing. Sorry for the trouble; we will add a fix to prevent this sudden error. Query.contains()
is intentional, so you can feel safe with this implemented 🙌
wait
now its giving me this error
Type error: Property 'createEmailSession' does not exist on type 'Account'. Did you mean 'createSession'? 60 | async login({ email, password }: LoginUserAccont) { 61 | try {
62 | return await account.createEmailSession(email, password); | ^ 63 | } catch (error: any) { 64 | throw error; 65 | } Error: Command "npm run build" exited with 1
on build
Recommended threads
- Got message for auto payment of 15usd fo...
how did this happen? 1. i claimed my 50usd credits via jsm hackathon - https://hackathon.jsmastery.pro/ 2. it asked me which org. to apply the credits on, i se...
- 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...
- Apple OAuth Scopes
Hi Hi, I've configured sign in with apple and this is the response i'm getting from apple once i've signed in. I cant find anywhere I set scopes. I remember se...