
When I try to use queries on users, it gives error saying invalid query method.
Now, I dont know whether it is possible or not to query users or it’s just some bad code from my side.
Any help will be appreciated.
TL;DR
Issue: Developer facing an error with the queries on users in the Node.js SDK for Appwrite, getting an "invalid query method" error.
Solution: The `list` method for users in Appwrite's Node.js SDK doesn't directly support queries. Instead, you can use the `createSearch` method to create a complex search query. Here's an updated code snippet:
```js
const search = new sdk.Search(client)
const queries = [sdk.Search.field('name', 'User Name')]; // Define your custom queries here
const result = await search.create('<COLLECTION_ID>', queries, '<SEARCH>');
```
Replace
Can you provide the code?

TypeScript
const sdk = require('node-appwrite');
const client = new sdk.Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const users = new sdk.Users(client);
const result = await users.list(
[], // queries (optional)
'<SEARCH>' // search (optional)
);
``` If its like this then this should work.....
Recommended threads
- appwrite cli alpine os
the appwrite cli does not work on alpine os if you install it using the recommended bash script. Maybe there is the possibility to compile it for alpine using t...
- Email OTP Mail Getting Delayed by 10 min...
I just noticed I am reciving delayed otp emails on frankfurt server we are on free plan now but we are planning to change to get on to paid plan can anyone plea...
- Invalid document structure: Unknown attr...
I have an attribute, who I deleted but it still gives error saying that Invalid document structure: Unknown attribute: "financialAidAvailable". Because of which...
