func (c *Collection) Repair() *Iter {
	// Clone session and set it to Monotonic mode so that the server
	// used for the query may be safely obtained afterwards, if
	// necessary for iteration when a cursor is received.
	session := c.Database.Session
	cloned := session.Clone()
	cloned.SetMode(Monotonic, false)
	defer cloned.Close()

	batchSize := int(cloned.queryConfig.op.limit)

	var result struct {
		Cursor struct {
			FirstBatch []bson.Raw "firstBatch"
			Id         int64
		}
	}

	cmd := repairCmd{
		RepairCursor: c.Name,
		Cursor:       &repairCmdCursor{batchSize},
	}

	clonedc := c.With(cloned)
	err := clonedc.Database.Run(cmd, &result)
	return clonedc.NewIter(session, result.Cursor.FirstBatch, result.Cursor.Id, err)
}
func (c *Collection) Repair() *Iter {
	// Clone session and set it to Monotonic mode so that the server
	// used for the query may be safely obtained afterwards, if
	// necessary for iteration when a cursor is received.
	session := c.Database.Session
	cloned := session.Clone()
	cloned.SetMode(Monotonic, false)
	defer cloned.Close()

	batchSize := int(cloned.queryConfig.op.limit)

	var result struct {
		Cursor struct {
			FirstBatch []bson.Raw "firstBatch"
			Id         int64
		}
	}

	cmd := repairCmd{
		RepairCursor: c.Name,
		Cursor:       &repairCmdCursor{batchSize},
	}

	clonedc := c.With(cloned)
	err := clonedc.Database.Run(cmd, &result)
	return clonedc.NewIter(session, result.Cursor.FirstBatch, result.Cursor.Id, err)
}
func ( c * Collection ) Repair ( ) * Iter { // Clone session and set it to Monotonic mode so that the server // used for the query may be safely obtained afterwards, if // necessary for iteration when a cursor is received. session := c . Database . Session cloned := session . Clone ( ) cloned . SetMode ( Monotonic , false ) defer cloned . Close ( ) batchSize := int ( cloned . queryConfig . op . limit ) var result struct { Cursor struct { FirstBatch [ ] bson . Raw " " Id int64 } } cmd := repairCmd { RepairCursor : c . Name , Cursor : & repairCmdCursor { batchSize } , } clonedc := c . With ( cloned ) err := clonedc . Database . Run ( cmd , & result ) return clonedc . NewIter ( session , result . Cursor . FirstBatch , result . Cursor . Id , err ) }
// Repair returns an iterator that goes over all recovered documents in the
// collection, in a best-effort manner. This is most useful when there are
// damaged data files. Multiple copies of the same document may be returned
// by the iterator.
//
// Repair is supported in MongoDB 2.7.8 and later.
Repair returns an iterator that goes over all recovered documents in the collection in a best - effort manner . This is most useful when there are damaged data files . Multiple copies of the same document may be returned by the iterator . Repair is supported in MongoDB 2 . 7 . 8 and later .