1
// Package mgo offers a rich MongoDB driver for Go.
3
// Details about the mgo project (pronounced as "mango") are found
6
// http://labix.org/mgo
8
// Usage of the driver revolves around the concept of sessions. To
9
// get started, obtain a session using the Dial function:
11
// session, err := mgo.Dial(url)
13
// This will establish one or more connections with the cluster of
14
// servers defined by the url parameter. From then on, the cluster
15
// may be queried with multiple consistency rules (see SetMode) and
16
// documents retrieved with statements such as:
18
// c := session.DB(database).C(collection)
19
// err := c.Find(query).One(&result)
21
// New sessions are typically created by calling session.Copy on the
22
// initial session obtained at dial time. These new sessions will share
23
// the same cluster information and connection pool, and may be easily
24
// handed into other methods and functions for organizing logic.
25
// Every session created must have its Close method called at the end
26
// of its life time, so its resources may be put back in the pool or
27
// collected, depending on the case.
29
// For more details, see the documentation for the types and methods.