How do I connect mongodb database with mongoose from my hono app and deploy in cloudflare workers?
I want to make an API that scales infinitely and handles as many requests.
I am thinking of using cloudflare workers with hono. but I am having a hard time connecting my mongodb database.
Please help me connect my database as cloudflare workers is serverless and I am concerned about how many new connections will be made everytime the workers runs or new worker is created.
Please HELP.
3 Replies
You can’t use mongoose in cf worker environment
So what do I use?
You can use realm-web or the Atalas Data API from MongoDB
https://www.mongodb.com/docs/atlas/device-sdks/web/
https://www.mongodb.com/docs/atlas/app-services/data-api/
https://www.mongodb.com/developer/products/atlas/cloudflare-worker-rest-api/
Create a REST API with Cloudflare Workers and MongoDB Atlas | MongoDB
Learn how to create a serverless REST API using Cloudflare workers and MongoDB Atlas.