在这里,我尝试运行此查询,但它给了我错误。我不明白为什么这是一个糟糕的要求。我正在尝试使用 accountId 从数据库中获取特定用户。请帮忙
这是调用获取当前用户的函数
export async function getCurrentUser() {
try {
const currentAccount = await account.get();
if (!currentAccount) throw Error;
const currentUser = await databases.listDocuments(
appwriteConfig.databaseId,
appwriteConfig.userCollectionId,
[Query.equal("accountId", [currentAccount.$id])]
);
console.log(currentUser);
if (!currentUser) throw Error;
return currentUser.documents[0];
} catch (error) {
console.log("from getCurrentUser");
console.log(error);
}
}
**此特定行未执行**
[Query.equal("accountId", [currentAccount.$id])]
请注意,如果没有 [Query.equal("accountId", [currentAccount.$id])] 这行,请求就可以正常工作。给我的回应
请帮忙!