Godeps/_workspace/src/gopkg.in/mgo.v2/session.go
func (q *Query) Count() (n int, err error) {
	q.m.Lock()
	session := q.session
	op := q.op
	limit := q.limit
	q.m.Unlock()

	c := strings.Index(op.collection, ".")
	if c < 0 {
		return 0, errors.New("Bad collection name: " + op.collection)
	}

	dbname := op.collection[:c]
	cname := op.collection[c+1:]
	query := op.query
	if query == nil {
		query = bson.D{}
	}
	result := struct{ N int }{}
	err = session.DB(dbname).Run(countCmd{cname, query, limit, op.skip}, &result)
	return result.N, err
}
func (q *Query) Count() (n int, err error) {
	q.m.Lock()
	session := q.session
	op := q.op
	limit := q.limit
	q.m.Unlock()

	c := strings.Index(op.collection, ".")
	if c < 0 {
		return 0, errors.New("Bad collection name: " + op.collection)
	}

	dbname := op.collection[:c]
	cname := op.collection[c+1:]
	query := op.query
	if query == nil {
		query = bson.D{}
	}
	result := struct{ N int }{}
	err = session.DB(dbname).Run(countCmd{cname, query, limit, op.skip}, &result)
	return result.N, err
}
func ( q * Query ) Count ( ) ( n int , err error ) { q . m . Lock ( ) session := q . session op := q . op limit := q . limit q . m . Unlock ( ) c := strings . Index ( op . collection , " " ) if c < 0 { return 0 , errors . New ( " " + op . collection ) } dbname := op . collection [ : c ] cname := op . collection [ c + 1 : ] query := op . query if query == nil { query = bson . D { } } result := struct { N int } { } err = session . DB ( dbname ) . Run ( countCmd { cname , query , limit , op . skip } , & result ) return result . N , err }
// Count returns the total number of documents in the result set.
Count returns the total number of documents in the result set .