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
- mcp-server-appwrite 0.4 fails on startup...
I’m trying to use `mcp-server-appwrite` against Appwrite Cloud and the server authenticates successfully, but fails during startup validation when probing `tabl...
- NEW ERROR Invalid document structure: At...
Error: ```AppwriteException: document_invalid_structure, Invalid document structure: Attribute "pb.kmsgxPkgInfo.id_info" must be an array (400)``` I’m encounter...
- Appwrite cloud is showing 500 Internal E...
Hey there, i've trying to access appwrite from around an hour and it's keep throwing 500. here's my project id: 69a7f0c60039b8205d2c