Versions in this module Expand all Collapse all v0 v0.9.0 Dec 15, 2015 Changes in this version + const Eventual + const Monotonic + const Strong + var ErrNotFound = errors.New("not found") + func IsDup(err error) bool + func ResetStats() + func SetDebug(debug bool) + func SetLogger(logger log_Logger) + func SetStats(enabled bool) + type BuildInfo struct + Bits int + Debug bool + GitVersion string + MaxObjectSize int + SysInfo string + Version string + VersionArray []int + type Change struct + Remove bool + ReturnNew bool + Update interface{} + Upsert bool + type ChangeInfo struct + Removed int + Updated int + UpsertedId interface{} + type Collection struct + Database *Database + FullName string + Name string + func (c *Collection) Count() (n int, err error) + func (c *Collection) Create(info *CollectionInfo) error + func (c *Collection) DropCollection() error + func (c *Collection) DropIndex(key ...string) error + func (c *Collection) EnsureIndex(index Index) error + func (c *Collection) EnsureIndexKey(key ...string) error + func (c *Collection) Find(query interface{}) *Query + func (c *Collection) FindId(id interface{}) *Query + func (c *Collection) Indexes() (indexes []Index, err error) + func (c *Collection) Insert(docs ...interface{}) error + func (c *Collection) Pipe(pipeline interface{}) *Pipe + func (c *Collection) Remove(selector interface{}) error + func (c *Collection) RemoveAll(selector interface{}) (info *ChangeInfo, err error) + func (c *Collection) RemoveId(id interface{}) error + func (c *Collection) Update(selector interface{}, update interface{}) error + func (c *Collection) UpdateAll(selector interface{}, update interface{}) (info *ChangeInfo, err error) + func (c *Collection) UpdateId(id interface{}, update interface{}) error + func (c *Collection) Upsert(selector interface{}, update interface{}) (info *ChangeInfo, err error) + func (c *Collection) UpsertId(id interface{}, update interface{}) (info *ChangeInfo, err error) + func (c *Collection) With(s *Session) *Collection + type CollectionInfo struct + Capped bool + DisableIdIndex bool + ForceIdIndex bool + MaxBytes int + MaxDocs int + type Credential struct + Mechanism string + Password string + Service string + Source string + Username string + type DBRef struct + Collection string + Database string + Id interface{} + type Database struct + Name string + Session *Session + func (db *Database) AddUser(user, pass string, readOnly bool) error + func (db *Database) C(name string) *Collection + func (db *Database) CollectionNames() (names []string, err error) + func (db *Database) DropDatabase() error + func (db *Database) FindRef(ref *DBRef) *Query + func (db *Database) GridFS(prefix string) *GridFS + func (db *Database) Login(user, pass string) error + func (db *Database) Logout() + func (db *Database) RemoveUser(user string) error + func (db *Database) Run(cmd interface{}, result interface{}) error + func (db *Database) UpsertUser(user *User) error + func (db *Database) With(s *Session) *Database + type DialInfo struct + Addrs []string + Database string + Dial func(addr net.Addr) (net.Conn, error) + DialServer func(addr *ServerAddr) (net.Conn, error) + Direct bool + FailFast bool + Mechanism string + Password string + Service string + Source string + Timeout time.Duration + Username string + type GridFS struct + Chunks *Collection + Files *Collection + func (gfs *GridFS) Create(name string) (file *GridFile, err error) + func (gfs *GridFS) Find(query interface{}) *Query + func (gfs *GridFS) Open(name string) (file *GridFile, err error) + func (gfs *GridFS) OpenId(id interface{}) (file *GridFile, err error) + func (gfs *GridFS) OpenNext(iter *Iter, file **GridFile) bool + func (gfs *GridFS) Remove(name string) (err error) + func (gfs *GridFS) RemoveId(id interface{}) error + type GridFile struct + func (file *GridFile) Close() (err error) + func (file *GridFile) ContentType() string + func (file *GridFile) GetMeta(result interface{}) (err error) + func (file *GridFile) Id() interface{} + func (file *GridFile) MD5() (md5 string) + func (file *GridFile) Name() string + func (file *GridFile) Read(b []byte) (n int, err error) + func (file *GridFile) Seek(offset int64, whence int) (pos int64, err error) + func (file *GridFile) SetChunkSize(bytes int) + func (file *GridFile) SetContentType(ctype string) + func (file *GridFile) SetId(id interface{}) + func (file *GridFile) SetMeta(metadata interface{}) + func (file *GridFile) SetName(name string) + func (file *GridFile) Size() (bytes int64) + func (file *GridFile) UploadDate() time.Time + func (file *GridFile) Write(data []byte) (n int, err error) + type Index struct + Background bool + Bits int + DropDups bool + ExpireAfter time.Duration + Key []string + Max int + Min int + Name string + Sparse bool + Unique bool + type Iter struct + func (iter *Iter) All(result interface{}) error + func (iter *Iter) Close() error + func (iter *Iter) Err() error + func (iter *Iter) For(result interface{}, f func() error) (err error) + func (iter *Iter) Next(result interface{}) bool + func (iter *Iter) Timeout() bool + type LastError struct + Code int + Err string + FSyncFiles int + N int + UpdatedExisting bool + UpsertedId interface{} + WTimeout bool + Waited int + func (err *LastError) Error() string + type MapReduce struct + Finalize string + Map string + Out interface{} + Reduce string + Scope interface{} + Verbose bool + type MapReduceInfo struct + Collection string + Database string + EmitCount int + InputCount int + OutputCount int + Time int64 + VerboseTime *MapReduceTime + type MapReduceTime struct + EmitLoop int64 + Map int64 + Total int64 + type Pipe struct + func (p *Pipe) All(result interface{}) error + func (p *Pipe) Iter() *Iter + func (p *Pipe) One(result interface{}) error + type Query struct + func (q *Query) All(result interface{}) error + func (q *Query) Apply(change Change, result interface{}) (info *ChangeInfo, err error) + func (q *Query) Batch(n int) *Query + func (q *Query) Count() (n int, err error) + func (q *Query) Distinct(key string, result interface{}) error + func (q *Query) Explain(result interface{}) error + func (q *Query) For(result interface{}, f func() error) error + func (q *Query) Hint(indexKey ...string) *Query + func (q *Query) Iter() *Iter + func (q *Query) Limit(n int) *Query + func (q *Query) LogReplay() *Query + func (q *Query) MapReduce(job *MapReduce, result interface{}) (info *MapReduceInfo, err error) + func (q *Query) One(result interface{}) (err error) + func (q *Query) Prefetch(p float64) *Query + func (q *Query) Select(selector interface{}) *Query + func (q *Query) Skip(n int) *Query + func (q *Query) Snapshot() *Query + func (q *Query) Sort(fields ...string) *Query + func (q *Query) Tail(timeout time.Duration) *Iter + type QueryError struct + Assertion bool + Code int + Message string + func (err *QueryError) Error() string + type Role string + const RoleClusterAdmin + const RoleDBAdmin + const RoleDBAdminAny + const RoleRead + const RoleReadAny + const RoleReadWrite + const RoleReadWriteAny + const RoleUserAdmin + const RoleUserAdminAny + type Safe struct + FSync bool + J bool + W int + WMode string + WTimeout int + type ServerAddr struct + func (addr *ServerAddr) String() string + func (addr *ServerAddr) TCPAddr() *net.TCPAddr + type Session struct + func Dial(url string) (*Session, error) + func DialWithInfo(info *DialInfo) (*Session, error) + func DialWithTimeout(url string, timeout time.Duration) (*Session, error) + func (s *Session) BuildInfo() (info BuildInfo, err error) + func (s *Session) Clone() *Session + func (s *Session) Close() + func (s *Session) Copy() *Session + func (s *Session) DB(name string) *Database + func (s *Session) DatabaseNames() (names []string, err error) + func (s *Session) EnsureSafe(safe *Safe) + func (s *Session) FindRef(ref *DBRef) *Query + func (s *Session) Fsync(async bool) error + func (s *Session) FsyncLock() error + func (s *Session) FsyncUnlock() error + func (s *Session) LiveServers() (addrs []string) + func (s *Session) Login(cred *Credential) error + func (s *Session) LogoutAll() + func (s *Session) Mode() mode + func (s *Session) New() *Session + func (s *Session) Ping() error + func (s *Session) Refresh() + func (s *Session) ResetIndexCache() + func (s *Session) Run(cmd interface{}, result interface{}) error + func (s *Session) Safe() (safe *Safe) + func (s *Session) SelectServers(tags ...bson.D) + func (s *Session) SetBatch(n int) + func (s *Session) SetCursorTimeout(d time.Duration) + func (s *Session) SetMode(consistency mode, refresh bool) + func (s *Session) SetPrefetch(p float64) + func (s *Session) SetSafe(safe *Safe) + func (s *Session) SetSocketTimeout(d time.Duration) + func (s *Session) SetSyncTimeout(d time.Duration) + type Stats struct + Clusters int + MasterConns int + ReceivedDocs int + ReceivedOps int + SentOps int + SlaveConns int + SocketRefs int + SocketsAlive int + SocketsInUse int + func GetStats() (snapshot Stats) + type User struct + OtherDBRoles map[string][]Role + Password string + PasswordHash string + Roles []Role + UserSource string + Username string