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>');
```
ReplaceCan 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
- general_route_not_found - Auth Guide
If you’ve just added a subdomain to your project, verified your DNS records, and confirmed your SSL certificate is working, but you're still hitting a `general_...
- Can't resume paused project
I have logged in in incognito, done the email verification and still get the invalid fingerprint error. What's the issue.
- Download appwrite Docs
Is there is a way to download appwrite Docs ? Because appwrite skill isn't enough to give the agent full understanding about how appwrite works (I noticed this ...