Skip to content

Can't query EmbeddedDocumentListField with parameters #182

Open
@pporcher

Description

@pporcher

EmbeddedDocumentListField can't be queried with parameters.

Running the example at https://github.com/graphql-python/graphene-mongo/tree/master/examples/flask_mongoengine
and replacing the query with

{
  allEmployees {
    edges {
      node {
        id,
        name,
        department {
          id,
          name
        },
        roles {
          edges {
            node {
              id,
              name
            }
          }
        },
        leader {
          id,
          name
        }
        tasks(last:1) { # note the parameter here
          edges {
            node {
              name,
              deadline
            }
          }
        }
      }
    }
  }
}

we get the errors

  "errors": [
    {
      "message": "'Task' object has no attribute 'pk'",
      "locations": [
        {
          "line": 23,
          "column": 9
        }
      ],
      "path": [
        "allEmployees",
        "edges",
        1,
        "node",
        "tasks"
      ]
    },
    {
      "message": "'Task' object has no attribute 'pk'",
      "locations": [
        {
          "line": 23,
          "column": 9
        }
      ],
      "path": [
        "allEmployees",
        "edges",
        2,
        "node",
        "tasks"
      ]
    }
  ]

How to solve this ?

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