mongodb

package
v0.0.0-...-9dbed75 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2025 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 {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(config *Config) (*Client, error)

NewClient creates a new MongoDB client instance

func (*Client) Close

func (c *Client) Close(ctx context.Context) error

Close disconnects from the MongoDB server

func (*Client) GetClient

func (c *Client) GetClient() *mongo.Client

GetClient returns the underlying mongo client

func (*Client) GetCollection

func (c *Client) GetCollection(name string) *mongo.Collection

GetCollection returns a handle to the specified collection

func (*Client) GetDatabase

func (c *Client) GetDatabase() *mongo.Database

GetDatabase returns the mongo database

type Config

type Config struct {
	URI      string
	Database string
	Timeout  time.Duration
}

Jump to

Keyboard shortcuts

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