cache Mongoose connections between hot reloads (#23321)
## Bug - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added ## Feature - [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Documentation added - [ ] Telemetry added. In case of a feature if it's used or not. ## Documentation / Examples - [ ] Make sure the linting passes - No, I get hundreds of unrelated errors like: ``` build/babel/plugins/next-page-config.ts(8,28): error TS2307: Cannot find module 'next/types'. build/entries.ts(11,32): error TS2307: Cannot find module '@next/env'. build/index.ts(1,31): error TS2307: Cannot find module '@next/env'. build/index.ts(9,10): error TS2305: Module '"next/dist/compiled/nanoid/index.cjs"' has no exported member 'nanoid'. ``` Re: https://github.com/Automattic/mongoose/issues/9987, the current Mongoose example doesn't do a good job of persisting state between hot reloads. Not sure why Lambda doesn't keep the same `import mongoose` between reloads, but it doesn't seem to. This approach lines up more closely with [Mongoose's Lambda docs](https://mongoosejs.com/docs/lambda.html) and the existing `with-mongodb` example.
Showing
Please
register
or
sign in
to comment