AppwriteException:无效查询:

问题描述 投票:0回答:1

在这里,我尝试运行此查询,但它给了我错误。我不明白为什么这是一个糟糕的要求。我正在尝试使用 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])] 这行,请求就可以正常工作。给我的回应

请帮忙!

javascript reactjs typescript database appwrite
1个回答
0
投票

也许您正在使用 appwrite: 14.0.0 |只需将其降级至 13.0.2 |转到您的 package.JSON 并将此 ("appwrite": "^14.0.0") 替换为 ("appwrite": "^13.0.2") 并再次安装依赖项 (npm i)。

一切都会解决的。

appwrite in package.jason

© www.soinside.com 2019 - 2024. All rights reserved.