#using mongoose with prisma ORM is useless right?

1 messages · Page 1 of 1 (latest)

buoyant pawn
#

using mongoose with prisma ORM is useless right?

naive orioleBOT
#

Hi @buoyant pawn. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

Using Mongoose with Prisma ORM is generally unnecessary and redundant. Both Mongoose and Prisma serve as Object-Relational Mappers (ORMs) but for different databases and use cases.

Mongoose is specifically designed for MongoDB, providing a straightforward way to model your data and interact with a MongoDB database. Prisma, on the other hand, is a next-gen ORM that supports multiple databases, including PostgreSQL, MySQL, SQL Server, and MongoDB (in preview).

If you are using Prisma to manage your database schema and queries, adding Mongoose into the mix would complicate your setup without providing additional benefits. Prisma already offers a type-safe query builder, migration system, and database management interface, which should cover most of your needs.

Here is an example of how you can configure Prisma to work with MongoDB:

datasource db {
  provider = "mongodb"
  url      = "mongodb://USERNAME:PASSWORD@HOST/DATABASE?authSource=admin&retryWrites=true&w=majority"
}

generator client {
  provider        = "prisma-client-js"
  previewFeatures = ["mongodb"]
}

Source (https://vercel.com/templates/next.js/fullstack-prisma-nextjs-blog)

For more information on using Prisma with MongoDB, you can refer to the Prisma documentation (https://www.prisma.io/docs/about/releases#preview).

In summary, using Mongoose with Prisma ORM is not recommended as it would be redundant and could complicate your project setup. Stick to one ORM that best fits your database and project requirements.

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: