Versions in this module Expand all Collapse all v0 v0.0.9 Sep 5, 2019 v0.0.8 Sep 5, 2019 v0.0.7 Sep 5, 2019 v0.0.6 Sep 5, 2019 v0.0.3 Sep 2, 2019 v0.0.2 Sep 2, 2019 Changes in this version type Collection + func (c *Collection) UpdateAllUseAf(selector interface{}, update interface{}, af interface{}) (info *ChangeInfo, err error) + func (c *Collection) UpdateUseAf(selector interface{}, update interface{}, af interface{}) error v0.0.1 Sep 1, 2019 Changes in this version + const Default + const UpdateLookup + var ErrCursor = errors.New("invalid cursor") + var ErrNotFound = errors.New("not found") + func IsDup(err error) bool + func ResetStats() + func SetDebug(debug bool) + func SetLogger(logger logLogger) + func SetStats(enabled bool) + type BuildInfo struct + Bits int + Debug bool + GitVersion string + MaxObjectSize int + OpenSSLVersion string + SysInfo string + Version string + VersionArray []int + func (bi *BuildInfo) VersionAtLeast(version ...int) bool + type Bulk struct + func (b *Bulk) Insert(docs ...interface{}) + func (b *Bulk) Remove(selectors ...interface{}) + func (b *Bulk) RemoveAll(selectors ...interface{}) + func (b *Bulk) Run() (*BulkResult, error) + func (b *Bulk) Unordered() + func (b *Bulk) Update(pairs ...interface{}) + func (b *Bulk) UpdateAll(pairs ...interface{}) + func (b *Bulk) Upsert(pairs ...interface{}) + type BulkError struct + func (e *BulkError) Cases() []BulkErrorCase + func (e *BulkError) Error() string + type BulkErrorCase struct + Err error + Index int + type BulkResult struct + Matched int + Modified int + type Change struct + Remove bool + ReturnNew bool + Update interface{} + Upsert bool + type ChangeInfo struct + Matched int + Removed int + Updated int + UpsertedId interface{} + type ChangeStream struct + func (changeStream *ChangeStream) Close() error + func (changeStream *ChangeStream) Err() error + func (changeStream *ChangeStream) Next(result interface{}) bool + func (changeStream *ChangeStream) ResumeToken() *bson.Raw + func (changeStream *ChangeStream) Timeout() bool + type ChangeStreamOptions struct + BatchSize int + FullDocument FullDocument + MaxAwaitTimeMS time.Duration + ResumeAfter *bson.Raw + type Collation struct + Alternate string + Backwards bool + CaseFirst string + CaseLevel bool + Locale string + MaxVariable string + Normalization bool + NumericOrdering bool + Strength int + type Collection struct + Database *Database + FullName string + Name string + func (c *Collection) Bulk() *Bulk + func (c *Collection) Count() (n int, err error) + func (c *Collection) Create(info *CollectionInfo) error + func (c *Collection) DropAllIndexes() error + func (c *Collection) DropCollection() error + func (c *Collection) DropIndex(key ...string) error + func (c *Collection) DropIndexName(name 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) NewIter(session *Session, firstBatch []bson.Raw, cursorId int64, err error) *Iter + 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) Repair() *Iter + func (c *Collection) Update(selector interface{}, update interface{}, af ...interface{}) error + func (c *Collection) UpdateAll(selector interface{}, update interface{}, af ...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 + func (coll *Collection) Watch(pipeline interface{}, options ChangeStreamOptions) (*ChangeStream, error) + type CollectionInfo struct + Capped bool + Collation *Collation + DisableIdIndex bool + ForceIdIndex bool + MaxBytes int + MaxDocs int + StorageEngine interface{} + ValidationAction string + ValidationLevel string + Validator interface{} + type Credential struct + Certificate *x509.Certificate + Mechanism string + Password string + Service string + ServiceHost 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(username, password string, readOnly bool) error + func (db *Database) C(name string) *Collection + func (db *Database) CollectionNames() (names []string, err error) + func (db *Database) CreateView(view string, source string, pipeline interface{}, collation *Collation) 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 + AppName string + Database string + Dial func(addr net.Addr) (net.Conn, error) + DialServer func(addr *ServerAddr) (net.Conn, error) + Direct bool + FailFast bool + MaxIdleTimeMS int + Mechanism string + MinPoolSize int + Password string + PoolLimit int + PoolTimeout time.Duration + ReadPreference *ReadPreference + ReadTimeout time.Duration + ReplicaSetName string + Safe Safe + Service string + ServiceHost string + Source string + Timeout time.Duration + Username string + WriteTimeout time.Duration + func ParseURL(url string) (*DialInfo, error) + func (i *DialInfo) Copy() *DialInfo + type FullDocument 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) Abort() + 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) SetUploadDate(t time.Time) + 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 + BucketSize float64 + Collation *Collation + DefaultLanguage string + DropDups bool + ExpireAfter time.Duration + Key []string + LanguageOverride string + Max int + Maxf float64 + Min int + Minf float64 + Name string + PartialFilter bson.M + Sparse bool + Unique bool + Weights map[string]int + type Iter struct + func (iter *Iter) All(result interface{}) error + func (iter *Iter) Close() error + func (iter *Iter) Done() bool + 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) State() (int64, []bson.Raw) + 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 Mode int + const DefaultConnectionPoolLimit + const Eventual + const Monotonic + const Nearest + const Primary + const PrimaryPreferred + const Secondary + const SecondaryPreferred + const Strong + type Pipe struct + func (p *Pipe) All(result interface{}) error + func (p *Pipe) AllowDiskUse() *Pipe + func (p *Pipe) Batch(n int) *Pipe + func (p *Pipe) Collation(collation *Collation) *Pipe + func (p *Pipe) Explain(result interface{}) error + func (p *Pipe) Iter() *Iter + func (p *Pipe) One(result interface{}) error + func (p *Pipe) SetMaxTime(d time.Duration) *Pipe + 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) Collation(collation *Collation) *Query + func (q *Query) Comment(comment string) *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) SetMaxScan(n int) *Query + func (q *Query) SetMaxTime(d time.Duration) *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 ReadPreference struct + Mode Mode + TagSets []bson.D + type Role string + const RoleClusterAdmin + const RoleDBAdmin + const RoleDBAdminAny + const RoleRead + const RoleReadAny + const RoleReadWrite + const RoleReadWriteAny + const RoleRoot + const RoleUserAdmin + const RoleUserAdminAny + type Safe struct + FSync bool + J bool + RMode string + 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(dialInfo *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) SetBypassValidation(bypass bool) + func (s *Session) SetCursorTimeout(d time.Duration) + func (s *Session) SetMode(consistency Mode, refresh bool) + func (s *Session) SetPoolLimit(limit int) + func (s *Session) SetPoolTimeout(timeout time.Duration) + 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 + PoolTimeouts int + ReceivedDocs int + ReceivedOps int + SentOps int + SlaveConns int + SocketRefs int + SocketsAlive int + SocketsInUse int + TimesSocketAcquired int + TimesWaitedForPool int + TotalPoolWaitTime time.Duration + func GetStats() (snapshot Stats) + type User struct + CustomData interface{} + OtherDBRoles map[string][]Role + Password string + PasswordHash string + Roles []Role + UserSource string + Username string