I noticed that official example using Query at the front end like this:
import { Client, Databases, Query } from "appwrite"
But I use it in node-appwrite at the server side like this:
import { Client, Databases, Query } from "node-appwrite"
Is it wrong about this? Is it can not work in node-appwrite sdk.
did you run the migrate command after upgrading?
that appwrite
is a client SDK. node-appwrite
is a server sdk. see https://appwrite.io/docs/sdks
yes, I have run the migrate command. 😫
It works for me 🧐
What results do you get if you filter for disabled = true?
It still lists all documents, same as never change the conditions. All conditions are not working at all. But the queries work well in local development env.
const client = new Client().setEndpoint(appwrite_endpoint).setProject(appwrite_project).setKey(appwrite_key);
const databases = new Databases(client);
const appwrite_conditions = [
Query.select(['$id', 'messageTitle']),
Query.equal('disabled', false),
Query.limit(10),
Query.orderDesc('created'),
];
const purpose = (context.query.purpose as string) ?? '';
if (purpose) {
appwrite_conditions.push(Query.equal('systemPurposeId', purpose));
}
return databases.listDocuments(appwrite_databaseId, appwrite_collectionId, appwrite_conditions).then(
(res: any) => {
return {
props: {
conversations: res.documents,
purpose: purpose,
},
};
},
(err) => {
return {
props: {
error: {
message: err.message ?? 'Unknown error.',
status: err.code ?? 500,
},
},
};
},
);
You have a local Appwrite instance and another Appwrite instance?
local for dev another at remote for prod
You definitely need to make sure you're connecting to the right instance...and the schemas match
How to view the logs of get documents with query to confirm the request url and test it?
Maybe traefik logs if it's enabled
To order you need to set "$createdAt"
With $
I have list all containers with command: docker ps And got the container id then checked the logs of traefik:2.7 image. There are only tow lines contents:
time="2023-05-27T02:20:01Z" level=info msg="Configuration loaded from flags."
time="2023-05-27T02:20:04Z" level=error msg="the router appwrite_realtime_wss@docker uses a non-existent resolver: dns"
accesslog is disable by default
You are right. But I defined a customized attribute named created.
Ok
Thanks.
I too have an issue with querying a collection using Query.equals('attribute','123') , i get nothing in return no matter what i do. I'm using cloud Appwrite so i cannot update it
Feel free to create a new post in <#1072905050399191082>
This post has been resolved. Earlier, I had changed the node-appwrite api request method from axios to fetch and losted the query parameter. Now, I have resumed and it is work well. It's all my fault.
[SOLVED] Queries not working
Recommended threads
- Get team fail in appwrite function
I try to get team of a user inside appwrite function, but i get this error: `AppwriteException: User (role: guests) missing scope (teams.read)` If i try on cl...
- Deploy function not working - 503
Hellon i get this error message, when i try to deploy a new version of a function <html><body><h1>503 Service Unavailable</h1>No server is available to handle...
- Error When load the website
Hi, I am getting this error whenever I reload my website please help me, I am using react Error: ** GET https://cloud.appwrite.io/v1/account 401 (Unauthoriz...