Appwrite :: getLikesByUserIdAndPostId :: error AppwriteException: Document with the requested ID co
- 0
- Web
const getLikesByUserIdAndPostId = async( userId: string, postId: string) => { try { console.log("userId ",userId) console.log("postId ",postId) console.log("likesCollection ",likesCollection)
const userDoc = await db.getDocument(palettegramDB, usersCollection, userId);
const postDoc = await db.getDocument(palettegramDB, postsCollection, postId);
if (userDoc && typeof userDoc === 'object') {
console.log("userId ", userDoc);
} else {
console.log("Error fetching user document");
}
console.log("postId ",postDoc)
const query = Query.and([
Query.equal("userId", userDoc.$id),
Query.equal("postId",postDoc.$id)
])
const likes = await db.listDocuments(
palettegramDB,
likesCollection,
[query]
)
return !!likes;
} catch (error) {
console.log("Appwrite :: getLikesByUserIdAndPostId :: error ",error);
}
} but there is data in usersCollections and postsCollection but it throwing error bz userDoc and postDoc value is null
Why did you delete your previous message in https://discord.com/channels/564160730845151244/1242108221972414475
it was not same error
What are the permissions on the collections and is document level security enabled?
all modification, read, create,update,delete
There is usersCollection with user details, postsCollection with post details and likesCollection have user reference with post reference. I am trying to fetch whether user is present in likesColllection with post id. This futher does that only ```const getLikesByUserIdAndPostId = async( userId: string, postId: string) => { try { console.log("userId ",userId) console.log("postId ",postId) console.log("likesCollection ",likesCollection)
const userDoc = await db.getDocument(palettegramDB, usersCollection, userId);
const postDoc = await db.getDocument(palettegramDB, postsCollection, postId);
if (userDoc && typeof userDoc === 'object') {
console.log("userId ", userDoc);
} else {
console.log("Error fetching user document");
}
console.log("postId ",postDoc)
const query = Query.and([
Query.equal("userId", userDoc.$id),
Query.equal("postId",postDoc.$id)
])
const likes = await db.listDocuments(
palettegramDB,
likesCollection,
[query]
)
return !!likes;
} catch (error) {
console.log("Appwrite :: getLikesByUserIdAndPostId :: error ",error);
}
}``` but its showing error. When I tried to console the value its throwing error on userDoc and postDoc.
Please share a screenshot
Please try granting Any access
its throwing same error for any access as well.
What about the related collections?
I have given any access to all collections likesCollection, postsCollection and userCollections
Screenshots please
of any access?
Yes
Recommended threads
- Intermittent 60s edge-to-origin stalls r...
Anyone having this problem? Region: SFO. Plan: Pro. UPDATE: "Fastly's documentation notes that enabling origin shielding can resolve backend connection problem...
- Vulnerabilities !!!
Why i can't mail to security@appwrite.io
- Error can not create `tablesdb` event wi...
When i'm trying to add an event with `tablesdb` i get an error message My event value: `tablesdb.mtg-decklist-dev.tables.queue_parsing.rows.*.create` Same err...