mongodb

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Database *mongo.Database
}

Client - MongodbClient struct

func NewClient

func NewClient(clientOptions *ClientOptions) (*Client, error)

NewClient - New Mongodb Client

func (*Client) Aggregate

func (db *Client) Aggregate(collection string, pipeline interface{}) (*mongo.Cursor, error)

Aggregate - aggregate query

func (*Client) Find

func (db *Client) Find(collection string, filters *bson.M, pagination pagination.Query) (*mongo.Cursor, error)

Find - find all documents

func (*Client) FindOne

func (db *Client) FindOne(collection string, filters *bson.M) *mongo.SingleResult

FindOne - find one document

func (*Client) FindOneAndUpdate

func (db *Client) FindOneAndUpdate(collection string, filters *bson.M, document *bson.M) *mongo.SingleResult

FindOneAndUpdate - find one document and update

func (*Client) InsertOne

func (db *Client) InsertOne(collection string, document *bson.M) (*mongo.InsertOneResult, error)

InsertOne - insert one document

func (*Client) InsertOneIfNotExist

func (db *Client) InsertOneIfNotExist(
	collection string,
	filters *bson.M,
	document *bson.M,
) (*mongo.InsertOneResult, error)

InsertOneIfNotExist - insert one document if not already exist

type ClientOptions

type ClientOptions struct {
	Host string
	Port string
	Name string
}

ClientOptions - Mongodb Client Options

Jump to

Keyboard shortcuts

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