mongobulk

package module
v0.0.0-...-bb7046d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 17, 2016 License: MIT Imports: 2 Imported by: 1

README

mongobulk

Wraps Golang mgo driver's Bulk type to enables batches of unlimited size

Documentation

Overview

Package mongobulk wraps mgo driver's Bulk type to enables batches of unlimited size.

Index

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

func Exec

func Exec(db *mgo.Database, collectionName string, config Config, f func(bulk *Bulk)) error

Types

type Bulk

type Bulk struct {
	Config
	Collection *mgo.Collection
	// contains filtered or unexported fields
}

func New

func New(collection *mgo.Collection, config Config) *Bulk

func (*Bulk) Finish

func (b *Bulk) Finish() error

func (*Bulk) Insert

func (b *Bulk) Insert(docs ...interface{})

func (*Bulk) Remove

func (b *Bulk) Remove(selectors ...interface{})

func (*Bulk) RemoveAll

func (b *Bulk) RemoveAll(selectors ...interface{})

func (*Bulk) Update

func (b *Bulk) Update(pairs ...interface{})

func (*Bulk) UpdateAll

func (b *Bulk) UpdateAll(pairs ...interface{})

func (*Bulk) Upsert

func (b *Bulk) Upsert(pairs ...interface{})

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
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL