I try to filter a row which contain a string inside a string array column, however I get the following error:
TypeScript
{"name":"AppwriteException","code":400,"type":"general_query_invalid","response":"{\"message\":\"Invalid query method: contains\",\"code\":400,\"type\":\"general_query_invalid\",\"version\":\"1.8.0\"}"}
Is Query.contains() not supported on Cloud?
This is the code snippet:
TypeScript
const queries = [
Query.or([
Query.contains('visibility', 'public'), // Include posts with public visibility
Query.contains('visibility', currentUserId), // Include posts visible to the current user
]),
];
try {
return await ctx.backendClient.tablesDb.getRow<IPostsRow>({
databaseId: CDBApp,
queries,
rowId: postId,
tableId: ETable.Posts,
});
} catch (e) {
ctx.error(JSON.stringify(e));
throw new IKNotFoundError();
}
The intent: Even if the post exists, it should only be returned if the user is allowed to see it according to the visibility
TL;DR
Function `Query.contains()` is not supported on Cloud. The error occurs due to using `Query.contains()` method on a string array column. To achieve the intended functionality of filtering rows based on string values within a string array column, use an alternative method or approach.Recommended threads
- AI feature by functions?
I'm creating a website where, in short, users can index certain genealogical content. In connection with the development of AI, I was thinking about introducing...
- deployment for Tanstack start is not run...
You can see the image, "Build archive was not created", even though build ran fine
- Unknown usage from one of my database
I need support help. For more than 2 weeks, i didn't make any requests to my database, but I have noticed huge amount of reads and writes requests: Around 8000...