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
- How to use Sites on selfhosted appwrite
whenever I try to create a site even with template it says 404 nginx error
- How to send Webhooks to internal network
When saving the URL for sending Webhooks, Appwrite checks if it's a valid external domain name so entering internal IP address or docker hostnames won't save th...
- Collections list not showing up when try...
I'm trying to create new relationship attribute but both one way and two way relationship is not showing up collections list to connect with my relationship att...