mongodb_client

package
v1.1.8 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConnectDb

func ConnectDb(config *MongodbConfig)

Connect Mongodb function will initialize and connect to mongodb based on the URL, Port and Host passed via config

func CreateCollection added in v1.1.3

func CreateCollection(dbName string, collectionName string)

Create Collection

func CreateCollections

func CreateCollections(dbName string, collections []string)

Create Collections

func CreateIndex added in v1.1.0

func CreateIndex(dbName string, collectionName string, indexModel mongo.IndexModel)

func CreateUniqueIndex added in v1.1.0

func CreateUniqueIndex(dbName string, collectionName string, field string)

func GetClient

func GetClient() *mongo.Client

GetClient returns the mongodb client.

func GetDb

func GetDb(dbName string) *mongo.Database

GetDb returns the mongodb client.

Types

type MongodbConfig

type MongodbConfig struct {
	Username string
	Password string
	Host     string
	Port     string
}

Jump to

Keyboard shortcuts

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