Skip to main content

MongoDB

ShipNowKit supports MongoDB database system. As a leading NoSQL database, MongoDB is known for its flexibility, scalability, and excellent support for JSON-like documents.

We recommend using MongoDB Atlas as the MongoDB hosting service provider. MongoDB Atlas is the official Database-as-a-Service (DBaaS) platform offering fully managed MongoDB deployments.

Key benefits of hosting MongoDB with MongoDB Atlas:

  • Global cloud deployment options (AWS, GCP, Azure)
  • Free tier available (512MB storage included)
  • Built-in security features
  • Automatic scaling and backups
  • 24/7 monitoring and alerts
  • Comprehensive documentation and support

1. Create MongoDB Service

Visit the MongoDB Atlas Console and log in to your account, then create a new database:

  1. After login first time, you will redirect to "Deploy your Cluster" page
  2. Select the free tier and fill the cluster configurations, then Click "Create Deployment" image.png

Tip: The free shared cluster is perfect for development and testing purposes. You can easily upgrade to a dedicated cluster when moving to production.

2. Cluster Info

After creating the cluster, you'll need to:

  1. Set up database access:

    • Create a database user with appropriate permissions
    • Set a secure password
    • Select roles for user. image.png
  2. Configure network access:

    • Add your IP address to the IP Access List
    • Or allow access from anywhere (0.0.0.0/0) for development image.png
  3. Get your connection string:

    • Click "Get connection string" button on your cluster
    • Copy the provided connection string image.png image.png

Add the connection string to environment configuration:

Set DATABASE_URL environment variable in Vercel

DATABASE_URL=mongodb+srv://[USERNAME]:[PASSWORD]@[CLUSTER-HOST]/[DB-NAME]?retryWrites=true&w=majority

3. Replace Database Schema

Run npm run db:use:mongodb, which will:

  • Copy db/prisma/variants/mongodb.prisma to db/prisma/schema.prisma
  • Execute prisma generate to create MongoDB-compatible Prisma Client

Unlike relational databases, MongoDB does not require a migrate operation, only replacing the database schema file is needed.

What Next?