CompatibilityOnly available on Node.js.You can still create API routes that use MongoDB with Next.js by setting the You can read more about Edge runtimes in the Next.js documentation here.
runtime
variable to nodejs
like so:chatHistory
that backs chat memory classes like BufferMemory
for a MongoDB instance.
Setup
You need to install Node MongoDB SDK in your project:npm
npm