graphene-mongo icon indicating copy to clipboard operation
graphene-mongo copied to clipboard

Can't query EmbeddedDocumentListField with parameters

Open pporcher opened this issue 4 years ago • 0 comments

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 ?

pporcher avatar Oct 07 '21 17:10 pporcher