Documentation ¶
Index ¶
- func HexToObjectID(vid []string) []primitive.ObjectID
- type Client
- type Collection
- func (c *Collection) CountDocuments(filter interface{}, opts ...*options.CountOptions) (int64, error)
- func (c *Collection) DeleteMany(filter interface{}, opts ...*options.DeleteOptions) (*mongo.DeleteResult, error)
- func (c *Collection) DeleteOne(filter interface{}, opts ...*options.DeleteOptions) (*mongo.DeleteResult, error)
- func (c *Collection) Duplicate() (*Client, *Collection, error)
- func (c *Collection) EstimatedDocumentCount(opts ...*options.EstimatedDocumentCountOptions) (int64, error)
- func (c *Collection) Find(filter interface{}, opts ...*options.FindOptions) (*Cursor, error)
- func (c *Collection) FindEx(filter interface{}, opts ...*options.FindOptions) (*Cursor, error)
- func (c *Collection) FindOne(filter interface{}, opts ...*options.FindOneOptions) *mongo.SingleResult
- func (c *Collection) FindOneAndDelete(filter interface{}, opts ...*options.FindOneAndDeleteOptions) *mongo.SingleResult
- func (c *Collection) FindOneAndUpdate(filter interface{}, update interface{}, ...) *mongo.SingleResult
- func (c *Collection) GetAll(x interface{}) error
- func (c *Collection) Indexes(models []mongo.IndexModel, opts ...*options.CreateIndexesOptions) ([]string, error)
- func (c *Collection) InsertMany(documents []interface{}, opts ...*options.InsertManyOptions) (*mongo.InsertManyResult, error)
- func (c *Collection) InsertOne(document interface{}, opts ...*options.InsertOneOptions) (*mongo.InsertOneResult, error)
- func (c *Collection) ReplaceOne(filter interface{}, replacement interface{}, opts ...*options.ReplaceOptions) (*mongo.UpdateResult, error)
- func (c *Collection) Transaction(cb TransactionCallback) error
- func (c *Collection) UpdateMany(filter interface{}, update interface{}, opts ...*options.UpdateOptions) (*mongo.UpdateResult, error)
- func (c *Collection) UpdateOne(filter interface{}, update interface{}, opts ...*options.UpdateOptions) (*mongo.UpdateResult, error)
- type Cursor
- type DB
- type TransactionCallback
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
Client ...
type Collection ¶
type Collection struct {
// contains filtered or unexported fields
}
Collection ...
func (*Collection) CountDocuments ¶
func (c *Collection) CountDocuments(filter interface{}, opts ...*options.CountOptions) (int64, error)
CountDocuments ...
func (*Collection) DeleteMany ¶
func (c *Collection) DeleteMany(filter interface{}, opts ...*options.DeleteOptions) (*mongo.DeleteResult, error)
DeleteMany deletes multiple documents from the collection.
func (*Collection) DeleteOne ¶
func (c *Collection) DeleteOne(filter interface{}, opts ...*options.DeleteOptions) (*mongo.DeleteResult, error)
DeleteOne deletes a single document from the collection.
func (*Collection) Duplicate ¶
func (c *Collection) Duplicate() (*Client, *Collection, error)
Duplicate ...
func (*Collection) EstimatedDocumentCount ¶
func (c *Collection) EstimatedDocumentCount(opts ...*options.EstimatedDocumentCountOptions) (int64, error)
EstimatedDocumentCount ...
func (*Collection) Find ¶
func (c *Collection) Find(filter interface{}, opts ...*options.FindOptions) (*Cursor, error)
Find then finds the documents matching a model.
func (*Collection) FindEx ¶
func (c *Collection) FindEx(filter interface{}, opts ...*options.FindOptions) (*Cursor, error)
FindEx duplicates and then finds the documents matching a model.
func (*Collection) FindOne ¶
func (c *Collection) FindOne(filter interface{}, opts ...*options.FindOneOptions) *mongo.SingleResult
FindOne returns up to one document that matches the model.
func (*Collection) FindOneAndDelete ¶
func (c *Collection) FindOneAndDelete(filter interface{}, opts ...*options.FindOneAndDeleteOptions) *mongo.SingleResult
FindOneAndDelete find a single document and deletes it, returning the original in result.
func (*Collection) FindOneAndUpdate ¶
func (c *Collection) FindOneAndUpdate(filter interface{}, update interface{}, opts ...*options.FindOneAndUpdateOptions) *mongo.SingleResult
FindOneAndUpdate finds a single document and updates it, returning either the original or the updated.
func (*Collection) Indexes ¶
func (c *Collection) Indexes(models []mongo.IndexModel, opts ...*options.CreateIndexesOptions) ([]string, error)
Indexes ..
func (*Collection) InsertMany ¶
func (c *Collection) InsertMany(documents []interface{}, opts ...*options.InsertManyOptions) (*mongo.InsertManyResult, error)
InsertMany inserts the provided documents.
func (*Collection) InsertOne ¶
func (c *Collection) InsertOne(document interface{}, opts ...*options.InsertOneOptions) (*mongo.InsertOneResult, error)
InsertOne inserts a single document into the collection.
func (*Collection) ReplaceOne ¶
func (c *Collection) ReplaceOne(filter interface{}, replacement interface{}, opts ...*options.ReplaceOptions) (*mongo.UpdateResult, error)
ReplaceOne replaces a single document in the collection.
func (*Collection) Transaction ¶
func (c *Collection) Transaction(cb TransactionCallback) error
Transaction ...
func (*Collection) UpdateMany ¶
func (c *Collection) UpdateMany(filter interface{}, update interface{}, opts ...*options.UpdateOptions) (*mongo.UpdateResult, error)
UpdateMany updates multiple documents in the collection.
func (*Collection) UpdateOne ¶
func (c *Collection) UpdateOne(filter interface{}, update interface{}, opts ...*options.UpdateOptions) (*mongo.UpdateResult, error)
UpdateOne updates a single document in the collection.
type DB ¶
DB ...
func (*DB) Collection ¶
func (db *DB) Collection(s string, options ...*options.CollectionOptions) *Collection
Collection ...
type TransactionCallback ¶
type TransactionCallback func(*mongo.Collection, mongo.SessionContext) error
TransactionCallback ...