...

/

Connect to the MongoDB Database

Connect to the MongoDB Database

Learn how to implement a GraphQL application with MongoDB Database.

Introduction

The storage used so far isn’t persistent, and the authentication feature hasn’t been available. Let’s replace it with persistent storage using the MongoDB database and add the authentication feature using the JSON Web Token (JWT) mechanism.

Define a configuration

Note: The .env file is required if a local machine is used. However, it has already been set up for you on the Educative platform.

We start by defining the database configuration, ...