resurrecting the dead here.
I have a problem with distinct query and sorting.
func (h *Handler) allTags() ([]*model.Tag, error) {
ms := h.ms.Copy()
defer ms.Close()
c := ms.DB(h.db).C(contentCollection)
tags := []*model.Tag{}
if e := c.Find(nil).Distinct("tags", &tags); e != nil {
return nil, e
}
return tags, nil
}
and I tried .Sort("tags") or "
tags.name" "tags.slug" but it's not working.
And I can't suffix another function after distinct.
I guess I have to manually sort the result, or is there a way?
Regards,
Darko