Nitrite
Nitrite is an embedded NoSQL document database for Rust.
Features
- Embedded Database - In-process database with no network overhead
- Document Store - Store JSON-like documents with flexible schemas
- Collections - Organize documents into named collections
- Indexing - Unique and non-unique indexes for fast queries
- Filters - Query documents using field-based filters
- Encryption - AES-GCM encryption for sensitive data
- Pluggable Storage - In-memory or persistent storage via modules
Quick Start
use Nitrite;
use field;
use doc;
// Create an in-memory database
let db = builder
.open_or_create
.expect;
// Get a collection
let collection = db.collection.unwrap;
// Insert a document
collection.insert.unwrap;
// Query documents
let cursor = collection.find.unwrap;
for doc in cursor
// Close the database
db.close.unwrap;
Indexing
use ;
// Create a unique index
collection.create_index.unwrap;
// Create a non-unique index
collection.create_index.unwrap;
Filters
use field;
// Equality
field.eq
// Comparison
field.gt
field.gte
field.lt
field.lte
// Logical operators
field.eq.and
field.eq.or
Storage Modules
Nitrite supports pluggable storage backends:
- In-memory - Built-in
InMemoryStoreModulefor testing and ephemeral data - Fjall - Persistent storage via
nitrite-fjall-adaptercrate - Spatial - Geospatial indexing via
nitrite-spatialcrate - Full-Text Search - Tantivy-based FTS via
nitrite-tantivy-ftscrate
License
Apache License 2.0