Documentation
¶
Overview ¶
Package mon_go provides a small, easy-to-use MongoDB client wrapper.
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
}
Client is a wrapper
func NewFromEnv ¶
NewFromEnv builds a client from env vars env vars: - MONGO_URI: connection string - MONGO_DB: default database name
func (*Client) Collection ¶
func (c *Client) Collection(name string) *mongo.Collection
Collection returns a collection from the default database
func (*Client) Disconnect ¶
Disconnect closes the client
type Config ¶
type Config struct {
// connection string
URI string
// default database name
Database string
// connectTimeout bounds the initial connection attempt
ConnectTimeout time.Duration
// pingTimeout bounds the initial ping call
PingTimeout time.Duration
// maxPoolSize sets the driver's max pool size, use 0 to keep driver defaults
MaxPoolSize uint64
}
Config holds the configuration for the MongoDB client
Click to show internal directories.
Click to hide internal directories.