4 min read
[DUMMY] Mongoose in a serverless runtime
Why the cached connection promise is not optional, and what happens the day you forget the model guard.
mongodbserverless
Serverless instances are ephemeral. Every cold start opens a new pool, and without a cached promise a busy dev session will exhaust the connection limit within minutes.
The model guard
Hot reload re-executes the module. Re-registering a schema either throws or silently rebinds the model to a stale one — the second failure mode is the dangerous one, because it looks like missing data rather than an error.