update

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2019 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CurrentDateType

type CurrentDateType string

CurrentDateType for the CurrentDate update operator

const (
	// Date as type for update operator
	Date CurrentDateType = "date"
	// Timestamp as type for update operator
	Timestamp CurrentDateType = "timestamp"
)

type Update

type Update *bson.M

Update fields

func AddToSet

func AddToSet(field string, value interface{}) Update

AddToSet adds the value to the array if it isnt already in the array

func BitAND

func BitAND(field string, value int) Update

BitAND does a bitwise AND between the selected field and the integer

func BitOR

func BitOR(field string, value int) Update

BitOR does a bitwise or between the selected field and the integer

func BitXOR

func BitXOR(field string, value int) Update

BitXOR does a bitwise XOR between the selected field and the integer

func CurrentDate

func CurrentDate(field string, typ CurrentDateType) Update

CurrentDate sets a certain field to the current date or timestamp

func Increment

func Increment(field string, amount float64) Update

Increment a field by a certain amount

func Multiply

func Multiply(field string, amount float64) Update

Multiply a field by a certain amount

func PopFirst

func PopFirst(field string) Update

PopFirst removes the first element from the array

func PopLast

func PopLast(field string) Update

PopLast removes the last element from the array

func Push

func Push(field string, newItems []interface{}) Update

Push all elements onto the array

func RemoveAll

func RemoveAll(field string, array []interface{}) Update

RemoveAll element(s) from an array that are in remove array

func Rename

func Rename(field string, newName string) Update

Rename a field to a new name

func Set

func Set(field string, value interface{}) Update

Set a field to a new value

func SetIfGreater

func SetIfGreater(field string, value interface{}) Update

SetIfGreater operator updates only when current stored value is greater than the new value

func SetIfLess

func SetIfLess(field string, value interface{}) Update

SetIfLess operator updates only when current stored value is less than the new value

func SetIfNew

func SetIfNew(field string, value interface{}) Update

SetIfNew a field to a new value if the document gets created by this update call

func Unset

func Unset(field string) Update

Unset removes a field from the document

Jump to

Keyboard shortcuts

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