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

Can't query EmbeddedDocumentListField with parameters #182

Open
pporcher opened this issue Oct 7, 2021 · 0 comments
Open

Can't query EmbeddedDocumentListField with parameters #182

pporcher opened this issue Oct 7, 2021 · 0 comments

Comments

@pporcher
Copy link

pporcher commented Oct 7, 2021

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 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant