Documentation ¶
Index ¶
- func NewClient(ctx context.Context, config *Config) *mongo.Client
- func NewClientWithTLS() (*mongo.Client, error)
- type ChangeStream
- type Client
- func (c *Client) Aggregate(ctx context.Context, dbName, collName string, pipeline mongo.Pipeline) (*mongo.Cursor, error)
- func (c *Client) BulkWrite(ctx context.Context, dbName, collName string, models []mongo.WriteModel, ...) (*mongo.BulkWriteResult, error)
- func (c *Client) ChangeStreamClient(client *mongo.Client, coll *mongo.Collection)
- func (c *Client) ChangeStreamCollection(client *mongo.Client, coll *mongo.Collection)
- func (c *Client) ChangeStreamDB(client *mongo.Client, coll *mongo.Collection)
- func (c *Client) Count(ctx context.Context, dbName, collName string, filter interface{}) (int64, error)
- func (c *Client) CountDocuments(ctx context.Context, dbName, collName string, filter interface{}) (int64, error)
- func (c *Client) CreateIndex(ctx context.Context, dbName, collName string, indexModel mongo.IndexModel) (string, error)
- func (c *Client) DeleteMany(ctx context.Context, dbName, collName string, filter interface{}) (*mongo.DeleteResult, error)
- func (c *Client) DeleteOne(ctx context.Context, dbName, collName string, filter interface{}) (*mongo.DeleteResult, error)
- func (c *Client) Distinct(ctx context.Context, dbName, collName string, fieldName string, ...) ([]interface{}, error)
- func (c *Client) DownLoadGridFS(ctx context.Context, fileID interface{}, db *mongo.Database, ...) (string, error)
- func (c *Client) DropIndex(ctx context.Context, dbName, collName string, indexName string) (bson.Raw, error)
- func (c *Client) EstimatedDocumentCount(ctx context.Context, dbName, collName string) (int64, error)
- func (c *Client) Find(ctx context.Context, dbName, collName string, filter interface{}) (*mongo.Cursor, error)
- func (c *Client) FindOne(ctx context.Context, dbName, collName string, filter interface{}) *mongo.SingleResult
- func (c *Client) FindWithOption(ctx context.Context, dbName, collName string, filter interface{}, ...) (*mongo.Cursor, error)
- func (c *Client) InsertMany(ctx context.Context, dbName, collName string, data []interface{}) (*mongo.InsertManyResult, error)
- func (c *Client) InsertOne(ctx context.Context, dbName, collName string, data interface{}) (*mongo.InsertOneResult, error)
- func (c *Client) ReplaceOne(ctx context.Context, dbName, collName string, filter interface{}, ...) (*mongo.UpdateResult, error)
- func (c *Client) RunCommand(ctx context.Context, dbName string, command interface{}) (bson.M, error)
- func (c *Client) UpdateByID(ctx context.Context, dbName, collName string, id interface{}, data interface{}) (*mongo.UpdateResult, error)
- func (c *Client) UpdateByIDWithSession(ctx context.Context, dbName, collName string, id interface{}, data interface{}) error
- func (c *Client) UpdateMany(ctx context.Context, dbName, collName string, filter interface{}, ...) (*mongo.UpdateResult, error)
- func (c *Client) UpdateManyWithSession(ctx context.Context, dbName, collName string, filter interface{}, ...) error
- func (c *Client) UpdateOne(ctx context.Context, dbName, collName string, filter interface{}, ...) (*mongo.UpdateResult, error)
- func (c *Client) UpdateOneWithSession(ctx context.Context, dbName, collName string, filter interface{}, ...) error
- func (c *Client) UploadGridFS(ctx context.Context, filename string, data interface{}, db *mongo.Database, ...) error
- type Config
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewClientWithTLS ¶
Types ¶
type ChangeStream ¶
type ChangeStream struct {
// contains filtered or unexported fields
}
ChangeStream define what to watch? client, database or collection
func (*ChangeStream) SetCollection ¶
func (cs *ChangeStream) SetCollection(collection string)
SetCollection se collection
func (*ChangeStream) SetDatabase ¶
func (cs *ChangeStream) SetDatabase(database string)
SetDatabase set database
func (*ChangeStream) SetPipeline ¶
func (cs *ChangeStream) SetPipeline(pipeline []bson.D)
SetPipeline set pipeline
func (*ChangeStream) Watch ¶
func (cs *ChangeStream) Watch(client *mongo.Client, cb callback)
Watch print oplog in JSON format
type Client ¶
type Client struct { *broker.BaseComponent RealCli *mongo.Client }
func (*Client) BulkWrite ¶
func (c *Client) BulkWrite(ctx context.Context, dbName, collName string, models []mongo.WriteModel, opts *options.BulkWriteOptions) (*mongo.BulkWriteResult, error)
func (*Client) ChangeStreamClient ¶
func (c *Client) ChangeStreamClient(client *mongo.Client, coll *mongo.Collection)
func (*Client) ChangeStreamCollection ¶
func (c *Client) ChangeStreamCollection(client *mongo.Client, coll *mongo.Collection)
func (*Client) ChangeStreamDB ¶
func (c *Client) ChangeStreamDB(client *mongo.Client, coll *mongo.Collection)
func (*Client) CountDocuments ¶
func (c *Client) CountDocuments(ctx context.Context, dbName, collName string, filter interface{}) (int64, error)
CountDocuments You can get an exact number of documents in a collection
func (*Client) CreateIndex ¶
func (*Client) DeleteMany ¶
func (*Client) DownLoadGridFS ¶
func (c *Client) DownLoadGridFS(ctx context.Context, fileID interface{}, db *mongo.Database, bucketOptions *options.BucketOptions) (string, error)
DownLoadGridFS ...
func (*Client) EstimatedDocumentCount ¶
func (c *Client) EstimatedDocumentCount(ctx context.Context, dbName, collName string) (int64, error)
EstimatedDocumentCount You can get an approximation on the number of documents in a collection
func (*Client) FindWithOption ¶
func (*Client) InsertMany ¶
func (*Client) ReplaceOne ¶
func (*Client) RunCommand ¶
func (*Client) UpdateByID ¶
func (*Client) UpdateByIDWithSession ¶
func (*Client) UpdateMany ¶
func (*Client) UpdateManyWithSession ¶
func (*Client) UpdateOneWithSession ¶
Click to show internal directories.
Click to hide internal directories.