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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

query object exceeds maximum depth when have multiple one to many relationships #6924

Closed
kpayson opened this issue Dec 14, 2020 · 2 comments
Closed
Labels
bug Repository Issues related to @loopback/repository package stale

Comments

@kpayson
Copy link

kpayson commented Dec 14, 2020

In my schema Tenants have multiple Clients and Clients have multiple Providers. When I write a query for tenants that includes Clients and includes the Providers inside the Clients I get a max depth exceeded error.

{"error":{"statusCode":400,"name":"Error","message":"The query object exceeds maximum depth 32","code":"QUERY_OBJECT_TOO_DEEP"}}  

I would really love to see this resolved. I have complex schema and need to write routines to export different subsets of the data. It will be quite hard to manually start to try to join the data together if I need to write multiplw queries and join the data together myself.

Here is the function that does the query:

  public async exportTenantData(
    @param.path.number('tenantId') tenantId: number
  ): Promise<any> {

    const inclusions = [
      {
        relation: 'clients',
        scope: {
          include: [
            {
              relation: 'providers',
              scope: {
                fields: { id: true }
              }
            },
          ]
        }
      },
    ];

    const filter = { include: inclusions };
    return this.tenantRepository.findById(tenantId, filter);
  }
@kpayson kpayson added the bug label Dec 14, 2020
@achrinza achrinza added the Repository Issues related to @loopback/repository package label Dec 15, 2020
@stale
Copy link

stale bot commented Jul 14, 2021

This issue has been marked stale because it has not seen activity within six months. If you believe this to be in error, please contact one of the code owners, listed in the CODEOWNERS file at the top-level of this repository. This issue will be closed within 30 days of being stale.

@stale stale bot added the stale label Jul 14, 2021
@stale
Copy link

stale bot commented Aug 13, 2021

This issue has been closed due to continued inactivity. Thank you for your understanding. If you believe this to be in error, please contact one of the code owners, listed in the CODEOWNERS file at the top-level of this repository.

@stale stale bot closed this as completed Aug 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Repository Issues related to @loopback/repository package stale
Projects
None yet
Development

No branches or pull requests

2 participants