github.com/slspeek/camlistore_namedsearch@v0.0.0-20140519202248-ed6f70f7721a/third_party/labix.org/v2/mgo/doc.go (about)

     1  // The mgo ("mango") rich MongoDB driver for Go.
     2  //
     3  // The mgo project (pronounced as "mango") is a rich MongoDB driver for
     4  // the Go language.  High-level details about the project may be found
     5  // at its web page:
     6  //
     7  //     http://labix.org/mgo
     8  //
     9  // Usage of the driver revolves around the concept of sessions.  To
    10  // get started, obtain a session using the Dial function:
    11  //
    12  //     session, err := mgo.Dial(url)
    13  //
    14  // This will establish one or more connections with the cluster of
    15  // servers defined by the url parameter.  From then on, the cluster
    16  // may be queried with multiple consistency rules (see SetMode) and
    17  // documents retrieved with statements such as:
    18  //
    19  //     c := session.DB(database).C(collection)
    20  //     err := c.Find(query).One(&result)
    21  //
    22  // New sessions may be created by calling New, Copy, or Clone on an
    23  // initial session.  These spawned sessions will share the same cluster
    24  // information and connection cache, and may be easily handed into other
    25  // methods and functions for organizing logic.  Every session created
    26  // must have its Close method called at the end of its use.
    27  //
    28  // For more details, see the documentation for the types and methods.
    29  //
    30  package mgo