Godeps/_workspace/src/gopkg.in/mgo.v2/session.go
func (q *Query) Explain(result interface{}) error {
	q.m.Lock()
	clone := &Query{session: q.session, query: q.query}
	q.m.Unlock()
	clone.op.options.Explain = true
	clone.op.hasOptions = true
	if clone.op.limit > 0 {
		clone.op.limit = -q.op.limit
	}
	iter := clone.Iter()
	if iter.Next(result) {
		return nil
	}
	return iter.Close()
}
func (q *Query) Explain(result interface{}) error {
	q.m.Lock()
	clone := &Query{session: q.session, query: q.query}
	q.m.Unlock()
	clone.op.options.Explain = true
	clone.op.hasOptions = true
	if clone.op.limit > 0 {
		clone.op.limit = -q.op.limit
	}
	iter := clone.Iter()
	if iter.Next(result) {
		return nil
	}
	return iter.Close()
}
func ( q * Query ) Explain ( result interface { } ) error { q . m . Lock ( ) clone := & Query { session : q . session , query : q . query } q . m . Unlock ( ) clone . op . options . Explain = true clone . op . hasOptions = true if clone . op . limit > 0 { clone . op . limit = - q . op . limit } iter := clone . Iter ( ) if iter . Next ( result ) { return nil } return iter . Close ( ) }
// Explain returns a number of details about how the MongoDB server would
// execute the requested query, such as the number of objects examined,
// the number of times the read lock was yielded to allow writes to go in,
// and so on.
//
// For example:
//
//     m := bson.M{}
//     err := collection.Find(bson.M{"filename": name}).Explain(m)
//     if err == nil {
//         fmt.Printf("Explain: %#v\n", m)
//     }
//
// Relevant documentation:
//
//     http://www.mongodb.org/display/DOCS/Optimization
//     http://www.mongodb.org/display/DOCS/Query+Optimizer
//
Explain returns a number of details about how the MongoDB server would execute the requested query such as the number of objects examined the number of times the read lock was yielded to allow writes to go in and so on . For example : m : = bson . M {} err : = collection . Find ( bson . M { filename : name } ) . Explain ( m ) if err == nil { fmt . Printf ( Explain : %#v \ n m ) } Relevant documentation : http : // www . mongodb . org / display / DOCS / Optimization http : // www . mongodb . org / display / DOCS / Query + Optimizer