Updating our Schema
Learn how to update a schema by using MongoDB with an endpoint.
We'll cover the following...
We'll cover the following...
Schema types and inputs
Our MongoDB database has three entities: Book, Author, and Review. Let’s consider the following schema:
MongoDB schema
To access our database, we will need to define our schema as follows (they can be different from the GrapghQL ones):
In the schema definition given above, we try to use different approaches when handling the relationship between entities. It’s important to note the following:
authorIdis a field in the book schema used to reference the author of the book.reviewIdsis an array of review