Skip to content

Ability to use filters on 'reverse' queries #22

@t-persson

Description

@t-persson

Description

Currently we allow a 'reverse' query on each event in the API.
These 'reverse' queries provide us with the ability to find which events link to this one.
The queries are very dumb and will always fetch every single event that links to the current event, even though we don't want them. This puts an extreme load on the mongodb server, slows down response time and gives us a lot of unnecessary information.

Motivation

Effectiveness in our queries and filtering is a key feature of graphql APIs.

Exemplification

Imagine that we have 1 EnvironmentDefined and 1 ConfidenceLevelModified linked to a testSuiteStarted.
By 'reverse' querying for 'EnvironmentDefined' we will also, every single time, query for the ConfidenceLevelModified. Event if we don't specify that want to search for it.
Imagine now that we have 1000 links.

{
  testSuiteStarted(last: 1) {
    edges {
      node {
        reverse {
          edges {
            node {
              ... on EnvironmentDefined {
                data {
                  name
                }
              }
            }
          }
        }
      }
    }
  }
}

Benefits

Faster response times, less CPU usage

Possible Drawbacks

None

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions