posts: Fixed AddMany not returning the IDs in the result.
the build was successful

This commit is contained in:
2018-12-05 20:58:37 +01:00
parent b60897a597
commit 2711654816
+3 -1
View File
@@ -8,6 +8,7 @@ import (
// AddMany adds multiple posts in on query. Each post gets a new ID and is associated with the log.
func AddMany(log models.Log, posts []models.Post) ([]models.Post, error) {
docs := make([]interface{}, len(posts))
copies := make([]models.Post, len(posts))
mutex.RLock()
defer mutex.RUnlock()
@@ -23,6 +24,7 @@ func AddMany(log models.Log, posts []models.Post) ([]models.Post, error) {
post.Position = startPosition + i
docs[i] = post
copies[i] = post
}
err = collection.Insert(docs...)
@@ -30,5 +32,5 @@ func AddMany(log models.Log, posts []models.Post) ([]models.Post, error) {
return nil, err
}
return posts, nil
return copies, nil
}