Documentation ¶
Index ¶
- type ArrayFilters
- type PopType
- type TypedUpdateManyModel
- func (umm *TypedUpdateManyModel) SetArrayFilters(filters options.ArrayFilters) *TypedUpdateManyModel
- func (umm *TypedUpdateManyModel) SetCollation(collation *options.Collation) *TypedUpdateManyModel
- func (umm *TypedUpdateManyModel) SetFilter(filter *filters.Filter) *TypedUpdateManyModel
- func (umm *TypedUpdateManyModel) SetHint(index string) *TypedUpdateManyModel
- func (umm *TypedUpdateManyModel) SetUpdate(update Update) *TypedUpdateManyModel
- func (umm *TypedUpdateManyModel) SetUpsert(upsert bool) *TypedUpdateManyModel
- func (umm *TypedUpdateManyModel) WriteModel() mongo.WriteModel
- type TypedUpdateOneModel
- func (uom *TypedUpdateOneModel) ArrayFilters(filters options.ArrayFilters) *TypedUpdateOneModel
- func (uom *TypedUpdateOneModel) Collation(collation *options.Collation) *TypedUpdateOneModel
- func (uom *TypedUpdateOneModel) Filter(filter *filters.Filter) *TypedUpdateOneModel
- func (uom *TypedUpdateOneModel) Hint(index string) *TypedUpdateOneModel
- func (uom *TypedUpdateOneModel) Update(update *Update) *TypedUpdateOneModel
- func (uom *TypedUpdateOneModel) Upsert(upsert bool) *TypedUpdateOneModel
- func (uom *TypedUpdateOneModel) WriteModel() mongo.WriteModel
- type TypedWriteModel
- type Update
- func AddEachToSet[T any](field string, value []T) *Update
- func AddToSet(field string, value any) *Update
- func CurrentDate(fields ...string) *Update
- func CurrentTimestamp(fields ...string) *Update
- func Dec(field string, delta int) *Update
- func Inc(field string, delta int) *Update
- func InsertAll(field string, value []any, index int) *Update
- func MaxFloat32(field string, cur float32) *Update
- func MaxFloat64(field string, cur float64) *Update
- func MaxInt(field string, cur int) *Update
- func MaxInt32(field string, cur int32) *Update
- func MaxInt64(field string, cur int64) *Update
- func MaxTime(field string, time time.Time) *Update
- func MinFloat32(field string, cur float32) *Update
- func MinFloat64(field string, cur float64) *Update
- func MinInt(field string, cur int) *Update
- func MinInt32(field string, cur int32) *Update
- func MinInt64(field string, cur int64) *Update
- func MinTime(field string, time time.Time) *Update
- func New() *Update
- func Pop(field string, pType PopType) *Update
- func Pull(field string, value any) *Update
- func PullAll(field string, value []any) *Update
- func PullConditioned(condition *filters.Filter) *Update
- func Push(field string, value any) *Update
- func PushEach(field string, value []any) *Update
- func PushLimited(field string, value []string, limit int) *Update
- func PushSorted(field string, value []string, sort *sorts.Options) *Update
- func Rename(field, newname string) *Update
- func Set(field string, value any) *Update
- func SetAll(pairs bson.M) *Update
- func SetOnInsert(field string, value any) *Update
- func SetOnInsertAll(pairs bson.M) *Update
- func Unset(fields ...string) *Update
- func (u *Update) AddEachToSet(field string, value []any) *Update
- func (u *Update) AddToSet(field string, value any) *Update
- func (u *Update) BitAnd(field string, val int) *Update
- func (u *Update) BitOr(field string, val int) *Update
- func (u *Update) BitXor(field string, val int) *Update
- func (u *Update) CurrentDate(fields ...string) *Update
- func (u *Update) CurrentTimestamp(fields ...string) *Update
- func (u *Update) Dec(field string, delta int) *Update
- func (u *Update) Document() bson.M
- func (u *Update) Inc(field string, delta int) *Update
- func (u *Update) InsertAll(field string, value []any, index int) *Update
- func (u *Update) MarshalBSON() ([]byte, error)
- func (u *Update) MaxFloat32(field string, cur float32) *Update
- func (u *Update) MaxFloat64(field string, cur float64) *Update
- func (u *Update) MaxInt(field string, cur int) *Update
- func (u *Update) MaxInt32(field string, cur int32) *Update
- func (u *Update) MaxInt64(field string, cur int64) *Update
- func (u *Update) MaxTime(field string, time time.Time) *Update
- func (u *Update) MinFloat32(field string, cur float32) *Update
- func (u *Update) MinFloat64(field string, cur float64) *Update
- func (u *Update) MinInt(field string, cur int) *Update
- func (u *Update) MinInt32(field string, cur int32) *Update
- func (u *Update) MinInt64(field string, cur int64) *Update
- func (u *Update) MinTime(field string, time time.Time) *Update
- func (u *Update) Pop(field string, pType PopType) *Update
- func (u *Update) Pull(field string, value any) *Update
- func (u *Update) PullAll(field string, value []any) *Update
- func (u *Update) PullConditioned(condition *filters.Filter) *Update
- func (u *Update) Push(field string, value any) *Update
- func (u *Update) PushEach(field string, value []any) *Update
- func (u *Update) PushLimited(field string, value []string, limit int) *Update
- func (u *Update) PushSorted(field string, value []string, sort *sorts.Options) *Update
- func (u *Update) Rename(field, newname string) *Update
- func (u *Update) Set(field string, value any) *Update
- func (u *Update) SetAll(pairs bson.M) *Update
- func (u *Update) SetOnInsert(field string, value any) *Update
- func (u *Update) SetOnInsertAll(pairs bson.M) *Update
- func (u *Update) Unset(fields ...string) *Update
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ArrayFilters ¶
type ArrayFilters struct {
// contains filtered or unexported fields
}
func NewArrayFilters ¶
func NewArrayFilters(filters ...*filters.Filter) *ArrayFilters
func (*ArrayFilters) Raw ¶
func (af *ArrayFilters) Raw() options.ArrayFilters
func (*ArrayFilters) Registry ¶
func (af *ArrayFilters) Registry(r *bsoncodec.Registry) *ArrayFilters
type TypedUpdateManyModel ¶
type TypedUpdateManyModel struct { TypedWriteModel // contains filtered or unexported fields }
func NewUpdateMany ¶
func NewUpdateMany() *TypedUpdateManyModel
NewUpdateMany creates a new UpdateManyModel.
func (*TypedUpdateManyModel) SetArrayFilters ¶
func (umm *TypedUpdateManyModel) SetArrayFilters(filters options.ArrayFilters) *TypedUpdateManyModel
SetArrayFilters specifies a set of filters to determine which elements should be modified when updating an array field.
func (*TypedUpdateManyModel) SetCollation ¶
func (umm *TypedUpdateManyModel) SetCollation(collation *options.Collation) *TypedUpdateManyModel
SetCollation specifies a collation to use for string comparisons. The default is nil, meaning no collation will be used.
func (*TypedUpdateManyModel) SetFilter ¶
func (umm *TypedUpdateManyModel) SetFilter(filter *filters.Filter) *TypedUpdateManyModel
SetFilter specifies a filter to use to select documents to update. The filter must be a document containing query operators. It cannot be nil.
func (*TypedUpdateManyModel) SetHint ¶
func (umm *TypedUpdateManyModel) SetHint(index string) *TypedUpdateManyModel
SetHint specifies the index to use for the operation. This should either be the index name as a string or the index specification as a document. This option is only valid for MongoDB versions >= 4.2. Server versions >= 3.4 will return an error if this option is specified. For server versions < 3.4, the driver will return a client-side error if this option is specified. The driver will return an error if this option is specified during an unacknowledged write operation. The driver will return an error if the hint parameter is a multi-key map. The default value is nil, which means that no hint will be sent.
func (*TypedUpdateManyModel) SetUpdate ¶
func (umm *TypedUpdateManyModel) SetUpdate(update Update) *TypedUpdateManyModel
SetUpdate specifies the modifications to be made to the selected documents. The value must be a document containing update operators (https://www.mongodb.com/docs/manual/reference/operator/update/). It cannot be nil or empty.
func (*TypedUpdateManyModel) SetUpsert ¶
func (umm *TypedUpdateManyModel) SetUpsert(upsert bool) *TypedUpdateManyModel
SetUpsert specifies whether or not a new document should be inserted if no document matching the filter is found. If an upsert is performed, the _id of the upserted document can be retrieved from the UpsertedIDs field of the BulkWriteResult.
func (*TypedUpdateManyModel) WriteModel ¶
func (umm *TypedUpdateManyModel) WriteModel() mongo.WriteModel
type TypedUpdateOneModel ¶
type TypedUpdateOneModel struct { TypedWriteModel // contains filtered or unexported fields }
func NewUpdateOne ¶
func NewUpdateOne() *TypedUpdateOneModel
NewUpdateOne creates a new UpdateOneModel.
func (*TypedUpdateOneModel) ArrayFilters ¶
func (uom *TypedUpdateOneModel) ArrayFilters(filters options.ArrayFilters) *TypedUpdateOneModel
ArrayFilters specifies a set of filters to determine which elements should be modified when updating an array field.
func (*TypedUpdateOneModel) Collation ¶
func (uom *TypedUpdateOneModel) Collation(collation *options.Collation) *TypedUpdateOneModel
Collation specifies a collation to use for string comparisons. The default is nil, meaning no collation will be used.
func (*TypedUpdateOneModel) Filter ¶
func (uom *TypedUpdateOneModel) Filter(filter *filters.Filter) *TypedUpdateOneModel
Filter specifies a filter to use to select the document to update. The filter must be a document containing query operators. It cannot be nil. If the filter matches multiple documents, one will be selected from the matching documents.
func (*TypedUpdateOneModel) Hint ¶
func (uom *TypedUpdateOneModel) Hint(index string) *TypedUpdateOneModel
Hint specifies the index to use for the operation. This should either be the index name as a string or the index specification as a document. This option is only valid for MongoDB versions >= 4.2. Server versions >= 3.4 will return an error if this option is specified. For server versions < 3.4, the driver will return a client-side error if this option is specified. The driver will return an error if this option is specified during an unacknowledged write operation. The driver will return an error if the hint parameter is a multi-key map. The default value is nil, which means that no hint will be sent.
func (*TypedUpdateOneModel) Update ¶
func (uom *TypedUpdateOneModel) Update(update *Update) *TypedUpdateOneModel
Update specifies the modifications to be made to the selected document. The value must be a document containing update operators (https://docs.mongodb.com/manual/reference/operator/update/). It cannot be nil or empty.
func (*TypedUpdateOneModel) Upsert ¶
func (uom *TypedUpdateOneModel) Upsert(upsert bool) *TypedUpdateOneModel
Upsert specifies whether or not a new document should be inserted if no document matching the filter is found. If an upsert is performed, the _id of the upserted document can be retrieved from the UpsertedIDs field of the BulkWriteResult.
func (*TypedUpdateOneModel) WriteModel ¶
func (uom *TypedUpdateOneModel) WriteModel() mongo.WriteModel
type TypedWriteModel ¶
type TypedWriteModel interface {
WriteModel() mongo.WriteModel
}
type Update ¶
type Update struct {
// contains filtered or unexported fields
}