Don't sort by text in the Iter

There is some issues with the sorting for iterators, it seems to crash
in big databases.
This commit is contained in:
Las Zenow 2015-04-28 11:29:32 -04:00
parent b178df89b0
commit 4ace7a687e
2 changed files with 4 additions and 5 deletions

View file

@ -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) {

View file

@ -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) {