package
0.3.5
Repository: https://github.com/nguyendang2000/shared-go.git
Documentation: pkg.go.dev

# Functions

NewQuery initializes and returns a new Query with an empty filter.
NewService initializes a new MongoDB connection using the given configuration and sets the timeout in the Service struct.

# Constants

DefaultBatchSize defines the default number of documents retrieved per batch.
30 seconds.
ErrCursorError represents an error when iterating over a MongoDB cursor.
ErrFailedToCheckExistence represents an error when checking for the existence of a document fails.
ErrFailedToConnect represents an error when the MongoDB connection fails.
ErrFailedToCountDocuments represents an error when counting documents in a collection fails.
ErrFailedToDecodeDocument represents an error when decoding a document from MongoDB fails.
ErrFailedToDeleteDocument represents an error when deleting a document from MongoDB fails.
ErrFailedToEstimateCount represents an error when retrieving an estimated count of documents fails.
ErrFailedToExecuteFind represents an error when a find query fails.
ErrFailedToFindOne represents an error when a find one query fails.
ErrFailedToGetDistinct represents an error when retrieving distinct values from a collection fails.
ErrFailedToInsertDocument represents an error when inserting a document into MongoDB fails.
ErrFailedToPing represents an error when a MongoDB ping operation fails.
ErrFailedToUpdateDocument represents an error when updating a document in MongoDB fails.
ErrInvalidResultArgument represents an error when the result argument is not a pointer to a slice.

# Variables

ErrDocumentNotFound is an alias for mongo.ErrNoDocuments to represent a document not found error.

# Structs

Config represents the configuration settings required for connecting to a MongoDB server.
Query is a wrapper around bson.M to help build MongoDB query filters.
Service struct contains the MongoDB client and a timeout field.