mgo

package
v0.0.0-...-fd96df4 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: Apache-2.0, BSD-2-Clause Imports: 2 Imported by: 0

README

The MongoDB driver for Go

Please go to http://labix.org/mgo for all project details.

Documentation

Overview

Package mgo provides support for Evergreen's remaining usages of the legacy MongoDB driver gopkg.in/mgo.v2. This package exists solely for backward compatibility and should not be used anymore in newer code.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsDup

func IsDup(err error) bool

IsDup returns whether err informs of a duplicate key error because a primary key index or a secondary unique index already has an entry with the given value.

Types

type BulkError

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

BulkError holds an error returned from running a Bulk operation. Individual errors may be obtained and inspected via the Cases method.

func (*BulkError) Cases

func (e *BulkError) Cases() []BulkErrorCase

Cases returns all individual errors found while attempting the requested changes.

See the documentation of BulkErrorCase for limitations in older MongoDB releases.

func (*BulkError) Error

func (e *BulkError) Error() string

type BulkErrorCase

type BulkErrorCase struct {
	Index int // Position of operation that failed, or -1 if unknown.
	Err   error
}

BulkErrorCase holds an individual error found while attempting a single change within a bulk operation, and the position in which it was enqueued.

MongoDB servers older than version 2.6 do not have proper support for bulk operations, so the driver attempts to map its API as much as possible into the functionality that works. In particular, only the last error is reported for bulk inserts and without any positional information, so the Index field is set to -1 in these cases.

type LastError

type LastError struct {
	Err             string
	Code, N, Waited int
	FSyncFiles      int `bson:"fsyncFiles"`
	WTimeout        bool
	UpdatedExisting bool        `bson:"updatedExisting"`
	UpsertedId      interface{} `bson:"upserted"`
}

func (*LastError) Error

func (err *LastError) Error() string

type QueryError

type QueryError struct {
	Code      int
	Message   string
	Assertion bool
}

func (*QueryError) Error

func (err *QueryError) Error() string

Directories

Path Synopsis
Package bson is an implementation of the BSON specification for Go:
Package bson is an implementation of the BSON specification for Go:
internal
json
Package json implements encoding and decoding of JSON as defined in RFC 4627.
Package json implements encoding and decoding of JSON as defined in RFC 4627.

Jump to

Keyboard shortcuts

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