A feature-rich MongoDB driver for Elixir supporting modern MongoDB versions, connection pooling, transactions, and GridFS.
The Elixir Driver for MongoDB is a comprehensive database connector that enables Elixir applications to interact with MongoDB databases. It provides full support for modern MongoDB features, including versions 4.x through 8.x, replica sets, and advanced operations like aggregation pipelines and change streams, while maintaining idiomatic Elixir patterns and performance optimizations.
Elixir developers building applications that require robust MongoDB integration, such as those needing support for transactions, GridFS, or real-time data streaming with change streams. It is also suitable for teams requiring a driver with modern protocol support and telemetry for monitoring.
Developers choose this driver for its specification compliance, idiomatic Elixir API, and extensive feature set including ACID transactions, connection pooling, and network compression. It balances performance with developer experience through sensible defaults and configurability, unlike simpler alternatives.
MongoDB driver for Elixir
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Compatible with MongoDB versions 4.x through 8.x, including replica sets, SCRAM-SHA-256, and features like change streams and ACID transactions, ensuring up-to-date protocol compliance.
Offers Elixir-native patterns with Mongo.Encoder and Mongo.Collection protocols for seamless struct-to-BSON encoding and decoding, reducing boilerplate for complex data.
Includes streaming cursors, network compression (zlib/zstd), and efficient connection pooling via DBConnection 2.x, optimizing throughput and resource usage.
Supports GridFS, bulk writes, migrations, and telemetry integration, providing a full toolkit for diverse MongoDB use cases in Elixir applications.
Default encoding/decoding loses document key order; preserving it requires using lists of tuples or configuring BSON.PreserveOrderDecoder, adding manual effort and potential errors.
Using Mongo.Collection for struct handling increases CPU usage compared to raw maps, as admitted in the README, making it less efficient for performance-sensitive operations.
Features like zstd compression require OTP 28+ or an external package (ezstd), and SSL configuration for AWS or Atlas can be complex with specific cipher requirements.