runebook · rune
runebook · rune
No capabilities requested.
manifest: sha256:39e67184a715c54b78bde27f37d3e1724e2bebd8503d8b06bbfed69801405ae2
rune add @rune/mongo@0.1.0rune add @rune/mongo
Provide a mongodb: or mongodb+srv: URL that names the database. The collection uses _id for record identity and a TTL index for expiration.
import { connect } from "@rune/mongo";
import { document } from "@rune/storage";
const db = await connect(process.env.DATABASE_URL!);
const visits = document(db.store, "visits", () => ({ total: 0 }));
await visits.update((value) => ({ total: value.total + 1 }));
// Call await db.close() when the connection is no longer needed.
Wrap an existing driver instance with mongoStore(collection).
Use db.store with Web Auth, or as a general-purpose record store.