Home
Type-safe MongoDB query and update builder for Rust
Welcome to the comprehensive user guide for Tnunctipun, a type-safe MongoDB query and update builder library for Rust.
Quick Navigation
📚 User Guide
- Introduction & Motivation - Project overview and why Tnuctipun exists
- Getting Started - Installation and basic setup
- Finding Documents - Query building with filters and projections
- Updating Documents - Type-safe update operations
- Derive Macros - Automatic trait implementations
- Advanced Topics - Performance tuning and edge cases
🔧 Reference Documentation
- API Docs.rs - Complete API documentation
- Crates.io - Released versions
📖 Examples
- Basic Usage - Simple queries and updates
- Complex Filters - Advanced filtering patterns
- Aggregation Pipelines - Complex data processing
- Real-World Scenarios - Production use cases
What is Tnuctipun?
Tnuctipun is a compile-time type-safe MongoDB query and update builder for Rust. It provides:
- Type Safety: Compile-time guarantees that your queries and updates are valid
- Zero Runtime Cost: No performance overhead compared to manual query building
- Ergonomic API: Intuitive, chainable interface for building complex queries
- Field Validation: Ensures referenced fields actually exist in your structs
- Update Safety: Prevents invalid update operations at compile time
Getting Started
Add Tnunctipun to your Cargo.toml
:
[dependencies]
tnuctipun = "0.1.1"
Then start building type-safe MongoDB queries:
use tnuctipun::{FieldWitnesses, MongoComparable, filters::empty, updates};
use serde::{Deserialize, Serialize};
#[derive(Debug, Serialize, Deserialize, FieldWitnesses, MongoComparable)]
struct User {
pub name: String,
pub email: String,
pub age: u32,
pub active: bool,
}
// Type-safe query building
let filter = empty::<User>()
.eq::<user_fields::Name, _>("Alice".to_string())
.gte::<user_fields::Age, _>(18)
.and();
// Type-safe updates
let update = updates::empty::<User>()
.set::<user_fields::Active, _>(true)
.inc::<user_fields::Age, _>(1)
.build();
Community & Support
- GitHub Repository: cchantep/tnuctipun
- Documentation: This user guide and API documentation
- Issues: Report bugs or request features on GitHub Issues