mongo-driver: go.mongodb.org/mongo-driver/mongo/writeconcern Index | Files

package writeconcern

import "go.mongodb.org/mongo-driver/mongo/writeconcern"

Index

Package Files

writeconcern.go

Variables

var ErrEmptyWriteConcern = errors.New("a write concern must have at least one field set")

ErrEmptyWriteConcern indicates that a write concern has no fields set.

var ErrInconsistent = errors.New("a write concern cannot have both w=0 and j=true")

ErrInconsistent indicates that an inconsistent write concern was specified.

var ErrNegativeW = errors.New("write concern `w` field cannot be a negative number")

ErrNegativeW indicates that a negative integer `w` field was specified.

var ErrNegativeWTimeout = errors.New("write concern `wtimeout` field cannot be negative")

ErrNegativeWTimeout indicates that a negative WTimeout was specified.

func AckWrite Uses

func AckWrite(wc *WriteConcern) bool

AckWrite returns true if a write concern represents an acknowledged write

func AcknowledgedValue Uses

func AcknowledgedValue(rawv bson.RawValue) bool

AcknowledgedValue returns true if a BSON RawValue for a write concern represents an acknowledged write concern. The element's value must be a document representing a write concern.

type Option Uses

type Option func(concern *WriteConcern)

Option is an option to provide when creating a WriteConcern.

func J Uses

func J(j bool) Option

J requests acknowledgement from MongoDB that write operations are written to the journal.

func W Uses

func W(w int) Option

W requests acknowledgement that write operations propagate to the specified number of mongod instances.

func WMajority Uses

func WMajority() Option

WMajority requests acknowledgement that write operations propagate to the majority of mongod instances.

func WTagSet Uses

func WTagSet(tag string) Option

WTagSet requests acknowledgement that write operations propagate to the specified mongod instance.

func WTimeout Uses

func WTimeout(d time.Duration) Option

WTimeout specifies specifies a time limit for the write concern.

type WriteConcern Uses

type WriteConcern struct {
    // contains filtered or unexported fields
}

WriteConcern describes the level of acknowledgement requested from MongoDB for write operations to a standalone mongod or to replica sets or to sharded clusters.

func New Uses

func New(options ...Option) *WriteConcern

New constructs a new WriteConcern.

func (*WriteConcern) Acknowledged Uses

func (wc *WriteConcern) Acknowledged() bool

Acknowledged indicates whether or not a write with the given write concern will be acknowledged.

func (*WriteConcern) GetJ Uses

func (wc *WriteConcern) GetJ() bool

GetJ returns the write concern journaling level.

func (*WriteConcern) GetW Uses

func (wc *WriteConcern) GetW() interface{}

GetW returns the write concern w level.

func (*WriteConcern) GetWTimeout Uses

func (wc *WriteConcern) GetWTimeout() time.Duration

GetWTimeout returns the write concern timeout.

func (*WriteConcern) IsValid Uses

func (wc *WriteConcern) IsValid() bool

IsValid checks whether the write concern is invalid.

func (*WriteConcern) MarshalBSONValue Uses

func (wc *WriteConcern) MarshalBSONValue() (bsontype.Type, []byte, error)

MarshalBSONValue implements the bson.ValueMarshaler interface.

func (*WriteConcern) WithOptions Uses

func (wc *WriteConcern) WithOptions(options ...Option) *WriteConcern

WithOptions returns a copy of this WriteConcern with the options set.

Package writeconcern imports 5 packages (graph) and is imported by 20 packages. Updated 2019-03-13. Refresh now. Tools for package owners.