mgo

package
v1.6.5 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Collection

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

func (*Collection) Aggregate

func (c *Collection) Aggregate(pipeline interface{}, opts ...*options.AggregateOptions) (*Cursor, error)

func (*Collection) BulkWrite

func (c *Collection) BulkWrite(models []mongo.WriteModel, opts ...*options.BulkWriteOptions) (*mongo.BulkWriteResult, error)

func (*Collection) Clone

func (c *Collection) Clone(opts ...*options.CollectionOptions) (*Collection, error)

func (*Collection) CountDocuments

func (c *Collection) CountDocuments(filter interface{}, opts ...*options.CountOptions) (int64, error)

func (*Collection) DeleteMany

func (c *Collection) DeleteMany(filter interface{}, opts ...*options.DeleteOptions) (*mongo.DeleteResult, error)

func (*Collection) DeleteOne

func (c *Collection) DeleteOne(filter interface{}, opts ...*options.DeleteOptions) (*mongo.DeleteResult, error)

func (*Collection) Distinct

func (c *Collection) Distinct(fieldName string, filter interface{}, opts ...*options.DistinctOptions) ([]interface{}, error)

func (*Collection) Drop

func (c *Collection) Drop() error

func (*Collection) EstimatedDocumentCount

func (c *Collection) EstimatedDocumentCount(opts ...*options.EstimatedDocumentCountOptions) (int64, error)

func (*Collection) Find

func (c *Collection) Find(filter interface{}, opts ...*options.FindOptions) (*Cursor, error)

func (*Collection) FindOne

func (c *Collection) FindOne(filter interface{}, opts ...*options.FindOneOptions) *mongo.SingleResult

func (*Collection) FindOneAndDelete

func (c *Collection) FindOneAndDelete(filter interface{}, opts ...*options.FindOneAndDeleteOptions) *mongo.SingleResult

func (*Collection) FindOneAndReplace

func (c *Collection) FindOneAndReplace(filter, replacement interface{}, opts ...*options.FindOneAndReplaceOptions) *mongo.SingleResult

func (*Collection) FindOneAndUpdate

func (c *Collection) FindOneAndUpdate(filter, update interface{}, opts ...*options.FindOneAndUpdateOptions) *mongo.SingleResult

func (*Collection) InsertMany

func (c *Collection) InsertMany(document []interface{}, opts ...*options.InsertManyOptions) (*mongo.InsertManyResult, error)

func (*Collection) InsertOne

func (c *Collection) InsertOne(document interface{}, opts ...*options.InsertOneOptions) (*mongo.InsertOneResult, error)

collection

func (*Collection) Orig

func (c *Collection) Orig() *mongo.Collection

func (*Collection) ReplaceOne

func (c *Collection) ReplaceOne(filter, replacement interface{}, opts ...*options.ReplaceOptions) (*mongo.UpdateResult, error)

func (*Collection) UpdateMany

func (c *Collection) UpdateMany(filter, update interface{}, opts ...*options.UpdateOptions) (*mongo.UpdateResult, error)

func (*Collection) UpdateOne

func (c *Collection) UpdateOne(filter, update interface{}, opts ...*options.UpdateOptions) (*mongo.UpdateResult, error)

func (*Collection) Upsert

func (c *Collection) Upsert(filter, update interface{}, opts ...*options.ReplaceOptions) (*mongo.UpdateResult, error)

func (*Collection) Watch

func (c *Collection) Watch(pipeline interface{}, opts ...*options.ChangeStreamOptions) (*mongo.ChangeStream, error)

type Cursor

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

func (*Cursor) All

func (c *Cursor) All(results interface{}) error

func (*Cursor) Close

func (c *Cursor) Close() error

func (*Cursor) Decode

func (c *Cursor) Decode(val interface{}) error

func (*Cursor) Next

func (c *Cursor) Next() bool

cursor

func (*Cursor) Orig

func (c *Cursor) Orig() *mongo.Cursor

type Mgo

type Mgo struct {
	*mongo.Database
}

func Ins

func Ins(id ...string) *Mgo

返回 mongodb 的一个数据库连接

func (*Mgo) C

func (m *Mgo) C(name string) *Collection

func (*Mgo) DB

func (m *Mgo) DB(name string) *Mgo

Jump to

Keyboard shortcuts

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