Skip to content

Querying & selecting nested relationship #10552

@Amrhub

Description

@Amrhub

👟 Reproduction steps

Tables:

  1. inspection
  2. customer
  3. car

Relationships:
customer -> car (one to many).
customer -> inspection (one to many).
car -> inspection (one to many).

Query:

Query.contains('plate_number', plateNumber),
      Query.equal('tenant_id', getUserActiveTenantId()),
      Query.select([
        '*',
        'inspections.$id',
        'inspections.type',
        'customer.*',
        'customer.inspections.type',
      ])

if query returns more than one car it will only attach customer.inspections to the first car the rest will only get customer only without the customer.inspections.

👍 Expected behavior

Every element in the car to obey to the query.select

👎 Actual Behavior

When multiple cars appeared on search:

Image Selecting `BAIC U5 PLUS` Image

When a single car appeared on search:

Image

Selecting the same vehicle BAIC U5 PLUS

Image

🎲 Appwrite version

Appwrite Cloud

💻 Operating system

MacOS

🧱 Your Environment

"appwrite": "^19.0.0",

👀 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?

Metadata

Metadata

Assignees

Labels

feature / relationshipsFixes and upgrades for database relationshipsproduct / databasesFixes and upgrades for the Appwrite Database.questionFurther information is requested

Type

No fields configured for Bug.

Projects

Status
Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions