mikejs / gomongo

Go driver for MongoDB

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Hi, Could you think about adding a function to collection.go?

kengonakajima opened this issue · comments

HI, I am using gomongo in my project and thank you for your great work!
Now I want to use SKIP and LIMIT on the query, so I added a function to the library.
the diff is really simple one:

mongo $ git diff
diff --git a/mongo/collection.go b/mongo/collection.go
index 87ccccd..8471c01 100644
--- a/mongo/collection.go
+++ b/mongo/collection.go
@@ -117,6 +117,10 @@ func (self *Collection) Query(query BSON, skip, limit int32) (*Cursor, os.Error)
        return &Cursor{self, reply.cursorID, 0, reply.documents}, nil
 }
 
+func (self *Collection) FindAllWithOptions(query BSON, skip int32, limit int32 ) (*Cursor, os.Error) {
+       return self.Query(query, skip, limit)
+}
+
 func (self *Collection) FindAll(query BSON) (*Cursor, os.Error) {
        return self.Query(query, 0, 0)
 }

I think many may want SKIP/LIMIT when querying, so above patch could be welcomed by many.

Hi, thx for patch