mongo

package
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2022 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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: https://docs.mongodb.com/manual/reference/connection-string/

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

Types

This section is empty.

Jump to

Keyboard shortcuts

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