[Bug] - Cannot find orders with no email

Trying to find all orders that do not have an associated email. Using the following query:

query getOrders {
  orders(first: 10, query:"-email:*"){
    edges {
      node {
        id
        email
      }
    }
  }
}

And I always get back an empty array. Tried across multiple versions of the graphql api. The opposite works fine to find all orders where email exists email:*

I suspect this is because the email field defaults to an empty string instead of a null value (even though its returned as null through the gql api if it isnt populated)

1 Like

Hey @Garrett_Hardin - thanks for flagging this. I think I was able to replicate this on my end. You are using the correct modifier syntax there, so it’s weird that it’s not returning results. I’m going to look into this further and loop back with you with next steps - hope to speak soon!

Thanks for looking into it

1 Like

No worries @Garrett_Hardin - just following up here and confirming, this is a possible issue on our end. I don’t have a turnaround time for a fix at the moment, but this is on our radar now, thanks again for mentioning this here in the forums, really appreciate it :slight_smile:

Hi @Garrett_Hardin

Have you tried searching with email set to an empty string explicitly?

query:"email:''"
 orders(first: 10, query:"-customer_id:*"){

you can use this for a workaround . email field is not available for my side

This wont work for our (admittedly not common) use case because you can set the email on an order without setting the customer id.

Actually this is another point, the admin api doesnt allow you to set or remove a customer from an order, only the email and shipping info