
My app is a social App where user can follow and unfollow each other, right now I don't know what i'm doing wrong but i want to be able to get posts of users if the user its contain in the array of user i'm following
Here is my Code
TypeScript
databaseId: Common.dataBasesId,
collectionId: Common.collectionStoryTellerId,
queries: [
Query.orderDesc('\$createdAt'),
Query.limit(500),
// Query.equal("userId", userId),
Query.contains("userId", ['${userModel.following}']),
],
);
return doc.documents;
Please, what i'm missing out on?
TL;DR
Developers want to retrieve posts from users they are following using the `Query.contains()` method, but the current code is not working as expected.
The `Query.contains()` method is typically used for checking if a value is present in an array. Instead of passing `['${userModel.following}']`, the developer should directly pass `userModel.following` in the method, as it's already an array.
Revised code:
```
DocumentList doc = await _db.listDocuments(
databaseId: Common.dataBasesId,
collectionId: Common.collectionStoryTellerId,
queries: [
Recommended threads
- Transferring self-hosted to cloud: will ...
I'd like to transition over to Appwrite cloud, but want to ensure my users won't be forced to re-login.
- Appwrite nameservers (ns1.appwrite.zone ...
When I try to change nameservers for my domain myultra.run on GoDaddy, I'm getting this error: We can't save your changes because this nameserver isn't register...
- AppwriteException: Project ID not found
I'm getting this error: `Error signing up: AppwriteException: Project with the requested ID could not be found. Please check the value of the X-Appwrite-Project...
