filter metaobjects by field

If I have a defined Metaobject definition with a field named “color”, how would I fetch only these metaobjects that only have a color of “blue”? The docs so far only refer to “first” / “last” options and “after/before”. Thanks!

Hi ,there

You could refer to below

query FilterMetaobjects {
  metaobjects(type:"xxxxx",first:10,query:"display_name:blue") {
    nodes {
      id
      type
      handle
      displayName
      fields {
        key
        value
      }
    }
  }
}

Also you need to enable the checkbox “Use this field as display_name”

Hi! I’ll give that a try! How can I find that checkbox you are referring to?

Hi, is there no other way to do this if it is not the display name?

And is there any way to leave out first or last? I would want all metaobjects of that type. Thanks!

Currently, I believe that either the first or last field is mandatory, and you are required to paginate all of the metaobjects.

Ah, darn. That’s inconvenient. Thank you!!