Skip to content
This repository has been archived by the owner on May 11, 2019. It is now read-only.

Commit

Permalink
Rename Collection.Query to Collection.Find
Browse files Browse the repository at this point in the history
  • Loading branch information
edsrzf committed Dec 9, 2010
1 parent 4c7b725 commit 9969fbc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -37,7 +37,7 @@ Insert a document into the collection:
Query the database: Query the database:


q := mongo.Query{"title": "Hello"} q := mongo.Query{"title": "Hello"}
cursor := col.Query(q, 0, 0) cursor := col.Find(q, 0, 0)
defer cursor.Close() defer cursor.Close()


See the documentation in the source for more information. See the documentation in the source for more information.
Expand Down
8 changes: 4 additions & 4 deletions collection.go
Expand Up @@ -93,9 +93,9 @@ func (c *Collection) Insert(doc bson.Doc) os.Error {
return c.db.conn.sendMessage(2002, 0, payload) return c.db.conn.sendMessage(2002, 0, payload)
} }


// Query searches c for any documents matching a query. It skips the first skip // Find searches c for any documents matching a query. It skips the first skip
// documents and limits the search to limit. // documents and limits the search to limit.
func (c *Collection) Query(query Query, skip, limit int32) (*Cursor, os.Error) { func (c *Collection) Find(query Query, skip, limit int32) (*Cursor, os.Error) {
conn := c.db.conn conn := c.db.conn
data, err := bson.Marshal(bson.Doc(query)) data, err := bson.Marshal(bson.Doc(query))
if err != nil { if err != nil {
Expand Down Expand Up @@ -125,12 +125,12 @@ func (c *Collection) Query(query Query, skip, limit int32) (*Cursor, os.Error) {


// FindAll returns all documents in c matching a query. // FindAll returns all documents in c matching a query.
func (c *Collection) FindAll(query Query) (*Cursor, os.Error) { func (c *Collection) FindAll(query Query) (*Cursor, os.Error) {
return c.Query(query, 0, 0) return c.Find(query, 0, 0)
} }


// FindOne returns the first document in c that matches a query. // FindOne returns the first document in c that matches a query.
func (c *Collection) FindOne(query Query) (bson.Doc, os.Error) { func (c *Collection) FindOne(query Query) (bson.Doc, os.Error) {
cursor, err := c.Query(query, 0, 1) cursor, err := c.Find(query, 0, 1)
if err != nil { if err != nil {
return nil, err return nil, err
} }
Expand Down

0 comments on commit 9969fbc

Please sign in to comment.