Documentation ¶
Index ¶
- func CollectionCount(c string, filters interface{}, opts ...*options.CountOptions) (string, int64)
- func CollectionDocuments(c string, Skip, Limit int64, sort, filter interface{}) *mongo.Cursor
- func CreateTTLIndex(c string, expireAfterSeconds int32) (string, error)
- func Delete(c string, key string, document interface{}) int64
- func DeleteAll(c string, filter interface{}) int64
- func Find(c string, key string, document interface{}) *mongo.SingleResult
- func FindAll(c string, filter interface{}) (*mongo.Cursor, error)
- func FindOneAndUpdate(c string, filter interface{}, document interface{}) *mongo.SingleResult
- func FindWithOptions(c string, filter interface{}, opts ...*options.FindOptions) (*mongo.Cursor, error)
- func Replace(c string, filter, documents interface{}) int64
- func Save(c string, document interface{}) *mongo.InsertOneResult
- func SaveAll(c string, documents []interface{}) *mongo.InsertManyResult
- func Sum(c string, pipeline string) ([]bson.M, error)
- func Update(c string, filter, document interface{}) int64
- func UpdateAll(c string, filter, documents interface{}) int64
- type Matchby
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CollectionCount ¶
func CollectionCount(c string, filters interface{}, opts ...*options.CountOptions) (string, int64)
CollectionCount return how many documents in the collection.
func CollectionDocuments ¶
CollectionDocuments returns many documents matching the given filter and other criteria options in the collection. sort 1 ascending and -1 descending.
func CreateTTLIndex ¶
CreateTTLIndex Create TTL Index for specified collection. returns the index name and error if it occurs.
func Find ¶
func Find(c string, key string, document interface{}) *mongo.SingleResult
Find returns a document matching the given filter in the collection.
func FindOneAndUpdate ¶
func FindOneAndUpdate(c string, filter interface{}, document interface{}) *mongo.SingleResult
FindOneAndUpdate updates a single document based on the filter with the document.
func FindWithOptions ¶
func FindWithOptions(c string, filter interface{}, opts ...*options.FindOptions) (*mongo.Cursor, error)
FindWithOptions returns matched documents with find options.
func Save ¶
func Save(c string, document interface{}) *mongo.InsertOneResult
Save saves one object to the database.
func SaveAll ¶
func SaveAll(c string, documents []interface{}) *mongo.InsertManyResult
SaveAll save many objects to the database.
Types ¶
Click to show internal directories.
Click to hide internal directories.