Documentation ¶
Overview ¶
Package mongodb provides support for accessing and executing commands against a mongoDB database
Index ¶
- Constants
- func CloneMasterSession() (*mgo.Session, error)
- func CloneMonotonicSession() (*mgo.Session, error)
- func CloneSession(useSession string) (*mgo.Session, error)
- func CloseSession(mongoSession *mgo.Session)
- func CollectionExists(mongoSession *mgo.Session, useDatabase string, useCollection string) bool
- func CopyMasterSession() (*mgo.Session, error)
- func CopyMonotonicSession() (*mgo.Session, error)
- func CopySession(useSession string) (*mgo.Session, error)
- func CreateSession(mode string, sessionName string, hosts []string, databaseName string, ...) error
- func Execute(mongoSession *mgo.Session, databaseName string, collectionName string, ...) error
- func GetCollection(mongoSession *mgo.Session, useDatabase string, useCollection string) *mgo.Collection
- func GetDatabase(mongoSession *mgo.Session, useDatabase string) *mgo.Database
- func Shutdown() error
- func Startup() error
- func ToString(queryMap interface{}) string
- func ToStringD(queryMap bson.D) string
Constants ¶
const ( // MasterSession provides direct access to master database. MasterSession = "master" // MonotonicSession provides reads to slaves. MonotonicSession = "monotonic" )
Variables ¶
This section is empty.
Functions ¶
func CloneMasterSession ¶
func CloneMasterSession() (*mgo.Session, error)
CloneMasterSession makes a clone of the master session for client use.
func CloneMonotonicSession ¶
func CloneMonotonicSession() (*mgo.Session, error)
CloneMonotonicSession makes a clone of the monotinic session for client use.
func CloneSession ¶
CloneSession makes a clone of the specified session for client use.
func CloseSession ¶
func CloseSession(mongoSession *mgo.Session)
CloseSession puts the connection back into the pool.
func CollectionExists ¶
CollectionExists returns true if the collection name exists in the specified database.
func CopyMasterSession ¶
func CopyMasterSession() (*mgo.Session, error)
CopyMasterSession makes a copy of the master session for client use.
func CopyMonotonicSession ¶
func CopyMonotonicSession() (*mgo.Session, error)
CopyMonotonicSession makes a copy of the monotonic session for client use.
func CopySession ¶
CopySession makes a copy of the specified session for client use.
func CreateSession ¶
func CreateSession(mode string, sessionName string, hosts []string, databaseName string, username string, password string) error
CreateSession creates a connection pool for use.
func Execute ¶
func Execute(mongoSession *mgo.Session, databaseName string, collectionName string, f func(*mgo.Collection) error) error
Execute the MongoDB literal function.
func GetCollection ¶
func GetCollection(mongoSession *mgo.Session, useDatabase string, useCollection string) *mgo.Collection
GetCollection returns a reference to a collection for the specified database and collection name.
func GetDatabase ¶
func GetDatabase(mongoSession *mgo.Session, useDatabase string) *mgo.Database
GetDatabase returns a reference to the specified database.
Types ¶
This section is empty.