Spaces:
Paused
Paused
Download lib/mongodb.ts from imkrish/ig-costing: direct link, hf CLI and curl.
- Browser
- Download file 547 Bytes
-
https://huggingface.co/spaces/imkrish/ig-costing/resolve/main/lib/mongodb.ts
- Command line
-
hf download hf://spaces/imkrish/ig-costing/lib/mongodb.ts
-
curl -L -o mongodb.ts https://huggingface.co/spaces/imkrish/ig-costing/resolve/main/lib/mongodb.ts
547 Bytes
| import { Db } from 'mongodb' | |
| import { shards } from './mongoPool' | |
| /** | |
| * Single-shard accessor for the costing group, kept so routes that haven't been | |
| * taught to fan out keep working unchanged. | |
| * | |
| * Safe while costing fits on one cluster - at ~0.3MB/day that is roughly 4.6 | |
| * years on a 512MB M0. Routes still using this will silently read only shard 0 | |
| * once costing spills, so they need converting to fanout() before that happens. | |
| */ | |
| export async function getDb(): Promise<Db> { | |
| const [first] = await shards('costing') | |
| return first | |
| } | |