From 4ace7a687e2b7a9961a4264cff1d5f8610801b1d Mon Sep 17 00:00:00 2001 From: Las Zenow Date: Tue, 28 Apr 2015 11:29:32 -0400 Subject: [PATCH] Don't sort by text in the Iter There is some issues with the sorting for iterators, it seems to crash in big databases. --- database/books.go | 5 ++--- database/database.go | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/database/books.go b/database/books.go index 77624ad..7441f04 100644 --- a/database/books.go +++ b/database/books.go @@ -98,9 +98,8 @@ func getNewBooks(coll *mgo.Collection, length int, start int) (books []Book, num return _getBooks(coll, bson.M{"$nor": []bson.M{{"active": true}}}, length, start) } -func getBooksIter(coll *mgo.Collection, query string) Iter { - q := getBookQuery(coll, buildQuery(query)) - return q.Iter() +func getBooksIter(coll *mgo.Collection) Iter { + return coll.Find(bson.M{}).Iter() } func _getBooks(coll *mgo.Collection, query bson.M, length int, start int) (books []Book, num int, err error) { diff --git a/database/database.go b/database/database.go index ac6905a..056cd86 100644 --- a/database/database.go +++ b/database/database.go @@ -70,9 +70,9 @@ func (db *DB) GetBooks(query string, length int, start int) (books []Book, num i return getBooks(booksColl, query, length, start) } -func (db *DB) GetBooksIter(query string) Iter { +func (db *DB) GetBooksIter() Iter { booksColl := db.session.DB(db.name).C(books_coll) - return getBooksIter(booksColl, query) + return getBooksIter(booksColl) } func (db *DB) GetNewBooks(length int, start int) (books []Book, num int, err error) {