Documentation ¶
Index ¶
- Variables
- func Close(uri ...string) error
- type BulkWriteResult
- type Client
- type Collection
- func (c *Collection) Aggregate(pipeline any, results any, opts ...*options.AggregateOptions) error
- func (c *Collection) FindByID(id primitive.ObjectID, result any) error
- func (c *Collection) Get() *mongo.Collection
- func (c *Collection) Index(keys ...bson.M) ([]string, error)
- func (c *Collection) Insert(doc any, opts ...*options.InsertOneOptions) (*mongo.InsertOneResult, error)
- func (c *Collection) InsertAll(docs []any, opts ...*options.InsertManyOptions) (*mongo.InsertManyResult, error)
- func (c *Collection) Where(filter bson.D) *Session
- type CollectionSpecification
- type Cursor
- type Database
- type DatabaseSpecification
- type DeleteResult
- type IndexSpecification
- type InsertManyResult
- type InsertOneResult
- type ListDatabasesResult
- type Pipeline
- type RewrapManyDataKeyResult
- type Session
- func (s *Session) C(collection string) *Collection
- func (s *Session) Client() *mongo.Client
- func (s *Session) Close()
- func (s *Session) Collection(collection string) *Collection
- func (s *Session) Connect() error
- func (s *Session) Count(opts ...*options.CountOptions) int64
- func (s *Session) DB(db string) *Database
- func (s *Session) FetchAll(results any) error
- func (s *Session) Find(result any) error
- func (s *Session) GetCollection() *mongo.Collection
- func (s *Session) GetTable() *Collection
- func (s *Session) Pagination(page, limit int, results any) (int64, error)
- func (s *Session) Ping() error
- func (s *Session) Remove(opts ...*options.DeleteOptions) error
- func (s *Session) RemoveID(id primitive.ObjectID, opts ...*options.DeleteOptions) error
- func (s *Session) RemoveOne(opts ...*options.DeleteOptions) error
- func (s *Session) Run(size int32, callback func(*mongo.Cursor)) error
- func (s *Session) SetOpts(opts ...interface{}) *Session
- func (s *Session) Update(update any, opts ...*options.UpdateOptions) (*mongo.UpdateResult, error)
- func (s *Session) UpdateID(id primitive.ObjectID, update any, opts ...*options.UpdateOptions) (*mongo.UpdateResult, error)
- func (s *Session) UpdateOne(update any, opts ...*options.UpdateOptions) (*mongo.UpdateResult, error)
- type SessionContext
- type UpdateResult
Constants ¶
This section is empty.
Variables ¶
var ErrNoDocuments = mongo.ErrNoDocuments
ErrNoDocuments is mongo: no document results
Functions ¶
Types ¶
type BulkWriteResult ¶
type BulkWriteResult = mongo.BulkWriteResult
type Collection ¶
type Collection struct {
// contains filtered or unexported fields
}
Collection mongo-driver collection
func (*Collection) Aggregate ¶
func (c *Collection) Aggregate(pipeline any, results any, opts ...*options.AggregateOptions) error
Aggregate performs an aggregation pipeline.
func (*Collection) FindByID ¶
func (c *Collection) FindByID(id primitive.ObjectID, result any) error
FindByID finds a single document by id.
func (*Collection) Get ¶ added in v0.1.57
func (c *Collection) Get() *mongo.Collection
get collection
func (*Collection) Index ¶
func (c *Collection) Index(keys ...bson.M) ([]string, error)
Index creates an index with the given keys and options.
func (*Collection) Insert ¶
func (c *Collection) Insert(doc any, opts ...*options.InsertOneOptions) (*mongo.InsertOneResult, error)
InsertWithResult inserts a single document into the collection and returns insert one result.
func (*Collection) InsertAll ¶
func (c *Collection) InsertAll(docs []any, opts ...*options.InsertManyOptions) (*mongo.InsertManyResult, error)
InsertAllWithResult inserts the provided documents and returns insert many result.
type CollectionSpecification ¶
type CollectionSpecification = mongo.CollectionSpecification
type Database ¶
type Database struct {
// contains filtered or unexported fields
}
Database mongo-driver database
func (*Database) Collection ¶
func (d *Database) Collection(collection string) *Collection
Collection returns collection.
func (*Database) CollectionNames ¶
CollectionNames returns the collection names present in database.
type DatabaseSpecification ¶
type DatabaseSpecification = mongo.DatabaseSpecification
type DeleteResult ¶
type DeleteResult = mongo.DeleteResult
type IndexSpecification ¶
type IndexSpecification = mongo.IndexSpecification
type InsertManyResult ¶
type InsertManyResult = mongo.InsertManyResult
type InsertOneResult ¶
type InsertOneResult = mongo.InsertOneResult
type ListDatabasesResult ¶
type ListDatabasesResult = mongo.ListDatabasesResult
type RewrapManyDataKeyResult ¶
type RewrapManyDataKeyResult = mongo.RewrapManyDataKeyResult
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
Session mongo session
func New ¶
New session
Relevant documentation:
https://docs.mongodb.com/manual/reference/connection-string/
func (*Session) Collection ¶
func (s *Session) Collection(collection string) *Collection
Collection returns collection
func (*Session) Count ¶
func (s *Session) Count(opts ...*options.CountOptions) int64
Count gets the number of documents matching the filter.
func (*Session) GetCollection ¶ added in v0.1.57
func (s *Session) GetCollection() *mongo.Collection
GetCollection return mongo Collection
func (*Session) Pagination ¶
Pagination pagination
func (*Session) Ping ¶
Ping verifies that the client can connect to the topology. If readPreference is nil then will use the client's default read preference.
func (*Session) RemoveOne ¶
func (s *Session) RemoveOne(opts ...*options.DeleteOptions) error
Remove one
func (*Session) Update ¶
func (s *Session) Update(update any, opts ...*options.UpdateOptions) (*mongo.UpdateResult, error)
Update all
func (*Session) UpdateID ¶
func (s *Session) UpdateID(id primitive.ObjectID, update any, opts ...*options.UpdateOptions) (*mongo.UpdateResult, error)
Update by id
func (*Session) UpdateOne ¶
func (s *Session) UpdateOne(update any, opts ...*options.UpdateOptions) (*mongo.UpdateResult, error)
Update one
type SessionContext ¶ added in v0.1.56
type SessionContext = mongo.SessionContext
type UpdateResult ¶
type UpdateResult = mongo.UpdateResult