DEV Community

Discussion on: GraphQL + Mongo v2. The easy way.

Collapse
 
aaron_powell profile image
Aaron Powell

What did Prisma actually do for us? We still wrote all the resolvers and queries and the schema? Does it allow us to connect to any kind of database? Trying to understand how to link graphQL into a persistent database. Thanks!

Collapse
 
alvarojsnish profile image
Álvaro • Edited

Prisma is playing as our ORM, making the transactions with the database. It does a lot of things in the background, solves for us the n+1 problem, does all the CRUD boilerplate operations, etc, you only need to call that "prisma" object with the table you want to query, in our case it's user(s).

But we still need to write our schemas and resolvers, of course, because that's how GraphQL works.

The "kind" of database that it allows to connect, it's defined on our docker-compose, in this case it's mongodb, but you can choose your database. We don't install anything like mongodb on our computer (mysql or postgres), docker does everything for us.

Here you have more info:
prisma.io/docs/get-started/01-sett...

And you can even start from an existing database:
prisma.io/docs/get-started/01-sett...

If you still want don't want to write resolvers or schemas, hasura simplifies this even more: hasura.io/

But, in the end, you need to code both.