Documentation
¶
Overview ¶
Package mongobulk wraps mgo driver's Bulk type to enables batches of unlimited size.
Index ¶
- Constants
- func Exec(db *mgo.Database, collectionName string, config Config, f func(bulk *Bulk)) error
- type Bulk
- func (b *Bulk) Finish() error
- func (b *Bulk) Insert(docs ...interface{})
- func (b *Bulk) Remove(selectors ...interface{})
- func (b *Bulk) RemoveAll(selectors ...interface{})
- func (b *Bulk) Update(pairs ...interface{})
- func (b *Bulk) UpdateAll(pairs ...interface{})
- func (b *Bulk) Upsert(pairs ...interface{})
- type Config
Constants ¶
View Source
const MaxOpsPerBatch = 1000
MaxOpsPerBatch is the maximum number of operations MongoDB supports in a bulk request.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Bulk ¶
type Bulk struct {
Config
Collection *mgo.Collection
// contains filtered or unexported fields
}
type Config ¶
type Config struct {
// OpsPerBatch is a number of operations to be queued up in a bulk request.
// The batch will be executed when this many operations get queued.
// Cannot exceed MaxOpsPerBatch, otherwise MongoDB will refuse to execute anything.
// Defaults to MaxOpsPerBatch.
OpsPerBatch int
}
Click to show internal directories.
Click to hide internal directories.