A Go pagination library for the official MongoDB driver that supports both normal queries and aggregation pipelines with full pagination metadata.
Mongo Go Pagination is a Go library that adds pagination functionality to the official MongoDB Go driver. It solves the problem of manually implementing pagination logic for MongoDB queries by providing a simple API that returns paginated results with metadata like total records, page numbers, and navigation information. It supports both regular find queries and aggregation pipelines.
Go developers building applications with MongoDB who need to implement paginated data retrieval for APIs or user interfaces. Particularly useful for backend engineers working on RESTful services or data-intensive applications.
Developers choose this library because it provides a standardized, production-ready pagination solution specifically designed for the official MongoDB driver, eliminating custom pagination code. Its unique selling point is supporting both normal queries and aggregation pipelines with a consistent API while returning complete pagination metadata.
Golang Mongodb Pagination for official mongodb/mongo-go-driver package which supports both normal queries and Aggregation pipelines with all information like Total records, Page, Per Page, Previous, Next, Total Page and query results.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Works seamlessly with both normal MongoDB find queries and complex aggregation pipelines, providing a consistent API for diverse query types, as demonstrated in the README examples.
Returns detailed metadata including total records, current page, per-page limit, and navigation indicators, eliminating manual calculations for API responses.
Offers a fluent interface with methods like Sort, Filter, Select, and Limit, making query building intuitive and readable, as shown in the code snippets.
For normal queries, automatically decodes results into Go structs using the Decode method, saving developers from writing boilerplate unmarshalling code.
As admitted in the README, direct struct decoding is only available for normal queries, not aggregation pipelines, requiring manual unmarshalling for complex queries, which adds overhead.
Relies on skip/limit pagination which can be inefficient on large datasets due to scanning skipped records; cursor-based pagination for real-time scenarios is not supported.
Designed exclusively for the official MongoDB Go driver, making it incompatible with alternative drivers or higher-level abstractions, limiting flexibility.