MongoDB Storage
Document-based storage with native TTL support.
The MongoDBStore leverages MongoDB's TTL indexes for automatic expiration of rate limit keys.
Installation
Pythonbash
pip install halt-rate[mongodb]TypeScriptbash
npm install mongodbUsage
Python
from halt.stores.mongodb import MongoDBStore
store = MongoDBStore(
uri="mongodb://localhost:27017",
database="halt",
collection="rate_limits"
)TypeScript
import { MongoDBStore } from 'halt-rate/stores/mongodb';
const store = new MongoDBStore({
connectionString: 'mongodb://localhost:27017',
database: 'halt',
collection: 'rate_limits'
});