groq-cli icon indicating copy to clipboard operation
groq-cli copied to clipboard

'--primary' flag no longer works

Open elimisteve opened this issue 5 years ago • 0 comments

At https://www.sanity.io/blog/we-re-open-sourcing-groq-a-query-language-for-json-documents we see the query

$ groq '*[gender == "female" && "physics" in prizes[].category]{firstname, surname}' \
  --url http://api.nobelprize.org/v1/laureate.json \
  --pretty --primary laureates

resulting in

[
    {
      "firstname": "Marie",
      "surname": "Curie, née Sklodowska"
    },
    {
      "firstname": "Maria",
      "surname": "Goeppert Mayer"
    },
    {
      "firstname": "Donna",
      "surname": "Strickland"
    }
  ]

but today it prints null.

It appears that --primary is no longer there, and that that is the culprit. I say that because the query works as expected when we use jq instead of groq's --primary flag:

$ curl -s http://api.nobelprize.org/v1/laureate.json | jq .laureates | groq '*[gender == "female" && "physics" in prizes[].category]{firstname, surname}' --pretty

elimisteve avatar Mar 15 '20 10:03 elimisteve