Browse Source

Added order to stories query response

1.0
Gisle Aune 6 years ago
parent
commit
2a40f97282
  1. 9
      model/story/story.go

9
model/story/story.go

@ -231,8 +231,13 @@ func List(author string, category string, tags []Tag, earliest, latest time.Time
query["open"] = *open
}
stories := make([]Story, 0, 128)
err := storyCollection.Find(query).Limit(limit).All(&stories)
size := limit
if size == 0 {
size = 128
}
stories := make([]Story, 0, size)
err := storyCollection.Find(query).Limit(limit).Sort("-updatedDate").All(&stories)
return stories, err
}

Loading…
Cancel
Save