A Rust library for managing MongoDB Atlas Local deployments using Docker. This library provides a high-level interface to interact with MongoDB Atlas Local deployments, making it easy to develop and test applications against a local MongoDB Atlas environment.
MongoDB Atlas Local Library simplifies the process of managing MongoDB Atlas Local deployments by providing a Rust-native interface that abstracts away the complexity of Docker container management. Whether you're developing applications that will eventually run against MongoDB Atlas or testing Atlas-specific features locally, this library provides the tools you need.
- Docker Integration: Seamlessly manages MongoDB Atlas Local deployments through Docker
- Rust Native: Built specifically for Rust applications with idiomatic APIs
- Simple Setup: Easy to integrate into existing Rust projects
- Development Ready: Perfect for local development and testing workflows
Since this library is not yet published to crates.io, you need to add it as a Git dependency to your Cargo.toml
:
[dependencies]
atlas-local-lib = { git = "https://github.com/mongodb/atlas-local-lib" }
For development and testing, you may also want to include tokio:
[dev-dependencies]
tokio = { version = "1.0", features = ["full"] }
Before using this library, make sure you have:
- Docker: Docker must be installed and running on your system
- Rust: Rust 1.70 or later (edition 2024)
Here's a simple example to get you started:
use bollard::Docker;
use atlas_local::Client;
use atlas_local::models::CreateDeploymentOptions;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Connect to Docker daemon
let docker = Docker::connect_with_socket_defaults()?;
// Create a new MongoDB Atlas Local client
let client = Client::new(docker);
// Create a deployment
client.create_deployment(&CreateDeploymentOptions::default()).await?;
// List the running deployments
let deployments = client.list_deployments().await.unwrap();
// Print the deployments
for deployment in deployments {
println!("[{}] \t{}", deployment.mongodb_version, deployment.name.unwrap_or_default());
}
// Delete the new deployment
client.delete_deployment("local1234").await?;
Ok(())
}
More examples can be found in examples/*
and ran using cargo run --example [example-name]
For building, testing, and generating documentation, see the CONTRIBUTING.md file which contains detailed instructions for all development commands.
The complete API documentation is available in the generated docs. Key components include:
Client
: The main entry point for managing MongoDB Atlas Local deployments- Error Types: Comprehensive error handling for Docker and Atlas operations
See CONTRIBUTING.md for detailed contributing guidelines.
This project is licensed under the terms specified in the project's license file.
- Bollard - Docker API client for Rust
- MongoDB Atlas - MongoDB's cloud database service
For issues and questions:
- Check the documentation
- Review existing issues
- Create a new issue if needed