Fixed error 'Unsupported document type for unmarshalling: []story.Chapter' in story.ListChapterStoryID

This commit is contained in:
2018-07-07 13:48:11 +02:00
parent 4bbb8bb9ae
commit 3f5af44dd6
+1 -1
View File
@@ -72,7 +72,7 @@ func FindChapterID(id string) (Chapter, error) {
// ListChapterStoryID lists all chapters for the story ID // ListChapterStoryID lists all chapters for the story ID
func ListChapterStoryID(storyID string) ([]Chapter, error) { func ListChapterStoryID(storyID string) ([]Chapter, error) {
chapters := make([]Chapter, 0, 8) chapters := make([]Chapter, 0, 8)
err := chapterCollection.Find(bson.M{"storyId": storyID}).Sort("createdDate").One(&chapters) err := chapterCollection.Find(bson.M{"storyId": storyID}).Sort("createdDate").All(&chapters)
if err != nil { if err != nil {
return nil, err return nil, err
} }