~nskaggs/+junk/xenial-test

« back to all changes in this revision

Viewing changes to src/gopkg.in/mgo.v2/doc.go

  • Committer: Nicholas Skaggs
  • Date: 2016-10-24 20:56:05 UTC
  • Revision ID: nicholas.skaggs@canonical.com-20161024205605-z8lta0uvuhtxwzwl
Initi with beta15

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Package mgo offers a rich MongoDB driver for Go.
 
2
//
 
3
// Details about the mgo project (pronounced as "mango") are found
 
4
// in its web page:
 
5
//
 
6
//     http://labix.org/mgo
 
7
//
 
8
// Usage of the driver revolves around the concept of sessions.  To
 
9
// get started, obtain a session using the Dial function:
 
10
//
 
11
//     session, err := mgo.Dial(url)
 
12
//
 
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:
 
17
//
 
18
//     c := session.DB(database).C(collection)
 
19
//     err := c.Find(query).One(&result)
 
20
//
 
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.
 
28
//
 
29
// For more details, see the documentation for the types and methods.
 
30
//
 
31
package mgo