Querying children objects

Hi guys,

I have this graphql query:

query getObject($streamId: String!, $objectId: String!, $objectQuery: [JSONObject!]) {
  stream(id: $streamId) {
    id
    name
    object(id: $objectId) {
      id
      data
      speckleType
      children(query: $objectQuery) {
        totalCount
        cursor
        objects {
          id
          data
          speckleType
        }
      }
    }
  }
}

And whenever $objectQuery is not null I get data back in the children field, but as soon as I try to filter the children they come back empty.
The funny thing is that it used to work a few days ago?

Examples:
With these variables

{
  "streamId": "382b3c2620",
  "objectId": "40559c6ec06ad128c0bfe5eb55024aff",
  "objectQuery": [{ "field": "speckle_type", "value": "Objects.Geometry.Mesh", "operator": "=" }]
}

I get this response:

{
  "data": {
    "stream": {
      "id": "382b3c2620",
      "name": "dandas2",
      "object": {
        "id": "40559c6ec06ad128c0bfe5eb55024aff",
        "data": {
          "id": "40559c6ec06ad128c0bfe5eb55024aff",
          "name": "Dandas Nodes",
          "@elements": [ ... ],  # <- lots of Speckle references
          "__closure": { ... }, # <- lots of stuff here too
          "speckle_type": "Speckle.Core.Models.Collection",
          "collectionType": "Dandas Nodes",
          "totalChildrenCount": null
        },
        "speckleType": "Speckle.Core.Models.Collection",
        "children": {
          "totalCount": 0,
          "cursor": null,
          "objects": []  # <- no stuff here :(
        }
      }
    }
  }
}

But having null as $objectQuery gives this result:

{
  "streamId": "382b3c2620",
  "objectId": "40559c6ec06ad128c0bfe5eb55024aff",
  "objectQuery": null
}
{
  "data": {
    "stream": {
      "id": "382b3c2620",
      "name": "dandas2",
      "object": {
        "id": "40559c6ec06ad128c0bfe5eb55024aff",
        "data": {
          "id": "40559c6ec06ad128c0bfe5eb55024aff",
          "name": "Dandas Nodes",
          "@elements": [ ... ],  # <- lots of Speckle references
          "__closure": { ... }, # <- lots of stuff here too
          "speckle_type": "Speckle.Core.Models.Collection",
          "collectionType": "Dandas Nodes",
          "totalChildrenCount": null
        },
        "speckleType": "Speckle.Core.Models.Collection",
        "children": {
          "totalCount": 0,  
          "cursor": "6de0e07dd432c57e4352c0799af5fedd",
          "objects": [ ... ]  # <- lots of stuff here :)
        }
      }
    }
  }
}

One thing I noticed that is wierd is that totalChildrenCount and totalCount are null and 0 respectively even though they should be a value.

if instead of null you remove the objectQuery altogether - does that produce children or not?

This produces children:

query getObject($streamId: String!, $objectId: String!) {
  stream(id: $streamId) {
    id
    name
    object(id: $objectId) {
      id
      data
      speckleType
      children {
        totalCount
        cursor
        objects {
          id
          data
          speckleType
        }
      }
    }
  }
}

I think this is related to a current issue being worked on: Missing model definitions in GraphQL response - #2 by gjedlicska

Got it :+1:
Will wait for the fix then :slight_smile:

Just wanted to say that the querying/filtering is working again, but the query now return the same objects multiple times. In the picture below I get the same children objects 4 times.

If you can share the project deets, we can look at this.

Sure!
https://app.speckle.systems/projects/382b3c2620/models/3d621da6c0

Same query as above

1 Like