GROQ ellipsis operator... and projections
Written by Lo Etheridge, Kapehe
On this week's Kap & Lauren learn GROQ - Part 5, we explored the ellipsis operator (...
), scope, chaining projections, and pickles. Kap and I are dill pickle lovers, but we welcome sweet pickle lovers with open arms! But enough about pickles, let's talk about the ellipsis operator.
Using the e-commerce sample dataset, we filtered through the candy products and pulled out the image []
array metadata, title
, and price
, but we wanted to get a count of categories associated with each candy bar. The ellipsis operator allowed us to use the count()
function in our projection and still return all of the attributes without having to list them individually. Once you make a specific projection, only what you specify in the expression will return. This is where the ellipsis operator shines, it brings all the available attributes along for the ride when you are making a custom field or computation.