Last events, by date and limit

I’d like to sort my events by date, and show only the 5 last ones.
Doing that way:

{{ range first 5 (sort .Site.Sections.event.Pages.ByDate) }}
{{ if ge .Date.Unix .Now.Unix }}
{{ .Render “short” }}

  {{ end }}

{{ end }}

If I have events with a date < now, they are counted in the 5. I couldn’t find a way to use a where statement with sort.

thanks

  {{ range first 5 (where (sort .Site.Sections.event.Pages.ByDate) ".Date.Unix" "ge" .Now.Unix) }}
  {{ .Render "short" }}
  {{ end }}

Looks like it is the solution