Version: v1.4.0 Latest Latest

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

Go to latest
Published: Sep 9, 2021 License: Apache-2.0 Imports: 15 Imported by: 0




This section is empty.


This section is empty.


func Client

func Client() *mongo.Client

func Close

func Close(ctx context.Context) error

func Database

func Database(name string) *mongo.Database

func ExtractDatabaseName

func ExtractDatabaseName(uri string) (dbName, extractedURI string, err error)

ExtractDatabaseName extracts database name from uri if exists, and returns it together with the extracted uri (without database name) ref:

func Init

func Init(ctx context.Context, uri string)

Init is a singleton, it will be initialized only once. In case the uri provides only a single host in the mongodb cluster, the system will attempt to connect without discovering other hosts in the cluster.

func InitWithOption

func InitWithOption(ctx context.Context, opt *options.ClientOptions)

InitWithOption is a singleton, it will be initialized only once.

func Ping

func Ping(ctx context.Context) error


This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL