Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃悰 Bug Report: listDocuments by multiple document ID's returning error "Invalid query: Attribute not found in schema: _uid" #8219

Open
2 tasks done
marc1107 opened this issue May 30, 2024 · 1 comment
Assignees
Labels
bug Something isn't working product / databases Fixes and upgrades for the Appwrite Database.

Comments

@marc1107
Copy link

marc1107 commented May 30, 2024

馃憻 Reproduction steps

When I use the Java SDK to retreive all documents which have any of the ID's in a list by using the following query:

List<String> queries =  List.of(Query.Companion.or(
                eventIds.stream()
                        .map(eventId -> Query.Companion.equal("$id", eventId.toString()))
                        .toList()
        ));

and the following code to execute the query:

databases.listDocuments(
                "event-db",
                "event",
                queries,
                new CoroutineCallback<>((result, error) -> {
                    if (error != null) {
                        log.error(error.getMessage());
                    } else {
                        assert result != null;
                        log.info("{} Events found", result.getDocuments().size());
                        result.getDocuments().forEach(document -> events.add(appwriteDataToEvent(document)));
                    }

                    latch.countDown();
                }));

馃憤 Expected behavior

It should return all the documents (in this case events) which have one of the id's in the eventId List (which is a List of UUID's).

馃憥 Actual Behavior

It actually throws the following error:
Invalid query: Attribute not found in schema: _uid

It seems like it is converting the "$id" to "_uid".

Discord thread: https://discord.com/channels/564160730845151244/1245305111539093585

馃幉 Appwrite version

Version 1.5.x

馃捇 Operating system

MacOS

馃П Your Environment

Appwrite v1.5.5 self hosted, Kotlin SDK v5.0.2

馃憖 Have you spent some time to check if this issue has been raised before?

  • I checked and didn't find similar issue

馃彚 Have you read the Code of Conduct?

@marc1107 marc1107 added the bug Something isn't working label May 30, 2024
@stnguyen90 stnguyen90 added the product / databases Fixes and upgrades for the Appwrite Database. label May 30, 2024
@stnguyen90
Copy link
Contributor

@marc1107, thanks for raising this issue! 馃檹馃徏 It's odd that you can query on $id like:

Query.equal("$id", ["id1", "id2"])

but it doesn't work when nested like:

Query.or([
  Query.equal("$id", ["id1"]),
  Query.equal("$id", ["id2"])
])

Let me bring this up to the team.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working product / databases Fixes and upgrades for the Appwrite Database.
Projects
None yet
Development

No branches or pull requests

3 participants