qmgo
Qmgo is a Go driver for MongoDB that wraps the official mongo-go-driver with a simpler, mgo-like API. It provides CRUD operations, transactions, hooks, and aggregation with minimal code changes for teams migrating from the legacy mgo library.
Key facts
Objective fields from the source. Values we can't verify are shown as “Unknown” rather than guessed.
| Field | Value |
|---|---|
| Repository | qiniu/qmgo |
| Owner | qiniu |
| Primary language | Go |
| License | Apache-2.0 — OSI-approved |
| Stars | 1.4k |
| Forks | 151 |
| Open issues | 52 |
| Latest release | v1.1.10 (2025-07-05) |
| Last updated | 2026-06-20 |
| Source | https://github.com/qiniu/qmgo |
What qmgo is
Built on top of MongoDB's official Go driver, Qmgo abstracts connection pooling, cursor management, and query building into a chainable API. It supports transactions with retry logic, lifecycle hooks (BeforeInsert, AfterInsert), automatic field management (createAt, updateAt, _id), and validation tags via go-playground/validator.
Get the qmgo source
Clone the repository and explore it locally.
git clone https://github.com/qiniu/qmgo.gitcd qmgo# follow the project's README for install & configurationNeed it deployed, integrated, or customized instead? DEV.co ships production installs.
Best use cases
Implementation considerations
- Requires Go 1.10+; MongoDB server 2.6+. Verify your Go version and MongoDB deployment versions before integration.
- Connection initialization via qmgo.Open() or qmgo.NewClient(); always defer Close(ctx) to avoid resource leaks.
- Struct tags (bson:"fieldname") must match MongoDB field names; use DefaultField or CustomFields() for automatic timestamp/ID injection.
- Hooks (BeforeInsert, AfterInsert, etc.) are optional but useful; context must flow through all operations for transaction support.
- Validation via go-playground/validator tags; ensure validation rules align with business logic before production deployment.
When to avoid it — and what to weigh
- Requiring cutting-edge MongoDB server features — Latest release is v1.1.10 (2025-07-05). Unknown whether all MongoDB 6.0+ and 7.0+ server features are fully supported; requires version compatibility check.
- Need for advanced ODM/ORM patterns — Qmgo is a thin convenience layer, not a full ORM. Complex schema modeling, relationship management, and validation workflows may require custom code or a heavier framework.
- High-performance, latency-sensitive systems — No performance benchmarks provided in README. Abstraction overhead vs. raw driver unknown; not recommended for microsecond-level SLA systems without profiling.
- Projects with zero MongoDB experience — Assumes familiarity with MongoDB query syntax, bson types, and transaction semantics. Documentation focus is mgo migrants, not MongoDB newcomers.
License & commercial use
Apache License 2.0 (Apache-2.0). A permissive open-source license allowing commercial use, modification, and distribution with attribution and liability disclaimer.
Apache-2.0 is a permissive OSI-approved license that explicitly permits commercial use, provided license and copyright notices are retained. No license fees or proprietary restrictions apply. However, consult your legal team for enterprise deployments to confirm compliance with internal policies.
DEV.co evaluation signals
Editorial assessment — not user reviews. Directional, with an explicit confidence level.
| Signal | Assessment |
|---|---|
| Maintenance | Active |
| Documentation | Adequate |
| License clarity | Clear |
| Deployment complexity | Low |
| DEV.co fit | Strong |
| Assessment confidence | High |
Qmgo inherits MongoDB driver security practices (TLS support via URI options, auth methods). Sensitive data in BSON documents is not encrypted at the driver level; rely on MongoDB server-side encryption or application-layer encryption. Input validation must use validator tags or custom logic—no automatic injection prevention. MongoDB network isolation and authentication remain operator responsibility.
Alternatives to consider
Official mongo-go-driver
More verbose but gives direct control and guaranteed compatibility with all MongoDB features. Use if your team is MongoDB-fluent and accepts more boilerplate.
mgo (legacy)
Only if staying on older Go/MongoDB versions. No longer maintained; security and compatibility gaps likely. Qmgo is the recommended migration path.
sqlc / GORM with MongoDB adapter
If you need a unified ORM across SQL and NoSQL. More overhead; overkill for MongoDB-only workloads but useful for polyglot backends.
Build on qmgo with DEV.co software developers
Qmgo cuts boilerplate and eases mgo migration. Assess fit for your backend with a technical review, then contact us to architect your MongoDB integration.
Talk to DEV.coRelated open-source tools
Surfaced by semantic similarity across the DEV.co open-source index.
Related on DEV.co
Explore the category and the services that help you build with it.
qmgo FAQ
Is Qmgo production-ready?
Can I migrate from mgo with minimal code changes?
Does Qmgo support MongoDB Atlas?
What is the performance overhead vs. raw mongo-go-driver?
Software development & web development with DEV.co
Adopting qmgo is usually one piece of a larger software development effort. As a software development agency, DEV.co provides software development services and web development expertise — pairing senior software developers and web developers with your team to design, build, and operate open-source databases software in production.
Ready to simplify your MongoDB workflow in Go?
Qmgo cuts boilerplate and eases mgo migration. Assess fit for your backend with a technical review, then contact us to architect your MongoDB integration.