| Crates.io | zoey-storage-mongo |
| lib.rs | zoey-storage-mongo |
| version | 0.1.1 |
| created_at | 2026-01-09 23:40:02.34412+00 |
| updated_at | 2026-01-09 23:56:20.269482+00 |
| description | MongoDB database adapter for ZoeyAI |
| homepage | |
| repository | https://github.com/Agent-Zoey/Zoey.git |
| max_upload_size | |
| id | 2033163 |
| size | 233,289 |
Always watching over your data
MongoDB storage adapter for ZoeyAI
A MongoDB implementation of the IDatabaseAdapter trait from zoey-core. Provides document-based storage with local vector search capabilities.
Add to your Cargo.toml:
[dependencies]
zoey-core = "0.1"
zoey-storage-mongo = "0.1"
use zoey_core::{AgentRuntime, RuntimeOpts, IDatabaseAdapter};
use zoey_storage_mongo::MongoAdapter;
use std::sync::Arc;
#[tokio::main]
async fn main() -> zoey_core::Result<()> {
// Create MongoDB adapter
let mut adapter = MongoAdapter::new(
"mongodb://localhost:27017",
"zoey_db"
);
// Initialize (creates collections and indexes)
adapter.init().await?;
// Use with runtime
let opts = RuntimeOpts::default()
.with_adapter(Arc::new(adapter));
let runtime = AgentRuntime::new(opts).await?;
Ok(())
}
This adapter implements local vector search using MongoDB aggregation pipelines with cosine similarity calculationβno MongoDB Atlas required.
use zoey_storage_mongo::vector_search::MongoVectorSearch;
let searcher = MongoVectorSearch::new(collection, 1536);
let results = searcher.search(SearchMemoriesParams {
embedding: query_vector,
count: 10,
..Default::default()
}).await?;
MONGODB_URI=mongodb://localhost:27017
MONGODB_DATABASE=zoey_db
// Local development
let adapter = MongoAdapter::new("mongodb://localhost:27017", "zoey_db");
// With authentication
let adapter = MongoAdapter::new(
"mongodb://user:password@localhost:27017",
"zoey_db"
);
// Replica set
let adapter = MongoAdapter::new(
"mongodb://host1:27017,host2:27017,host3:27017/?replicaSet=rs0",
"zoey_db"
);
| Crate | Description |
|---|---|
zoey-core |
Core runtime and IDatabaseAdapter trait |
zoey-storage-sql |
SQLite & PostgreSQL adapters |
zoey-storage-supabase |
Supabase adapter |
zoey-storage-vector |
Local vector storage |
MIT License - See LICENSE for details.
π Your secrets are safe with Zoey