Documentation ¶
Index ¶
- func Aggregate(ctx context.Context, col string, query []bson.M, value interface{}) error
- func Count(ctx context.Context, col string) (int64, error)
- func CountWithFilter(ctx context.Context, col string, filter interface{}) (int64, error)
- func CountWithQuery(ctx context.Context, col string, query any) (int, error)
- func DeleteOne(ctx context.Context, col string, query bson.M) (mongo.DeleteResult, error)
- func FindOne(ctx context.Context, col string, query bson.M, value interface{}) error
- func GetMongoClient() *mongo.Client
- func GetMongoDb() *mongo.Database
- func Init(cp DatabaseCredentialHelper, host string, port string, database string)
- func InsertOne(ctx context.Context, col string, input interface{}) (mongo.InsertOneResult, error)
- func Ping() bool
- func UpdateOne(ctx context.Context, col string, filter bson.M, update bson.M) (mongo.UpdateResult, error)
- type DatabaseCredentialHelper
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CountWithFilter ¶
func GetMongoClient ¶ added in v0.0.13
func GetMongoDb ¶
GetMongoDb function returns a pointer to the `mongo.Database` instance used to communicate with MongoDB server. The function simply returns the MongoDB client instance stored in a `mongodb` singleton object. This function is used to obtain the MongoDB client connection in other parts of the application.
func Init ¶
func Init(cp DatabaseCredentialHelper, host string, port string, database string)
Initializes the mongodb client
Types ¶
Click to show internal directories.
Click to hide internal directories.