Configuration

Night mode

Running createUser Mutation

A$AP GraphQL Server with NodeJS and MongoDB 🚀 Course

Engineers From These Top Companies and Universities Trust EXLskills

1M+ Professionals | 100+ Institutions

This is the EXLskills free and open-source GraphQL Server with NodeJS and MongoDB A$AP Course! It's a highly-accelerated open course that's best-suited for people with IT developer background in "legacy" technologies to quickly get up to speed with the content of the modern IT Dev Tool Chest, learn a concrete marketable hot skill and hit the ground running again!
After this course, you'll be able to apply modern development practices to building and deploying sophisticated backend software on popular platforms with huge demand for skilled resources! Convert your "legacy" experience into a hot modern skill A$AP. Get comfortable with Docker, container orchestration, Git, and dive into JavaScript code implementing a complete GraphQL server in NodeJS over MongoDB. On your laptop and in the Cloud.
For further practice, we recommend checking out our Guided Projects that will give you access to a professional developer, detailed documentation, and real-world tasks that you can work on to go from the basics into building production apps.

Is this course FREE?

Yes, this a 100% free course that you can contribute to on GitHub here!

Have more questions?

Entering and Modifying Data via GraphQL

Running createUser Mutation

createUser Mutation

Let's get this out of the way: mutation sounds like an awful term to use in the everyday IT practice, unless your software application field is biology or gaming. Anything - modifications, updates, inserts - is completely normal to a developer's ear. But as the industry evolves (or mutates) - we've got to get used to new terms. As long as they don't convert IT developers into mutants - everything is completely fine. Moving on.

As we did when working with the queries, with the GraphQL server running in the node-dev container's shell, open a browser on the host and navigate to the GraphiQL tester http://localhost:8080/graph. This time, though, let's expand the QUERY VARIABLES section at the bottom of the left pane and copy this content from doc/graphql-grahiql-samples.md ( Mutations, Create User, Variables ) into there:

Notice $user_data_input in two places in the mutation code - matching the name defined in the Query Variables section. In GraphiQL, variables can be used in queries as well - rather than writing long conditions directly inside (). For mutations, as we have to explicitly provide the input type (CreateUserInput!) - use of variables is the common practice. The ! at the end of the Input Type's name reflects everyone's excitement about this technology.

Running the Mutation

As this is going to mutate the data in our MongoDB, we need to be prepared to un-mutate if we want to test certain transactions again. Conveniently, MongoDB Compass has a quick delete option at the Document level in the Collections GUI, so have Compass running.

The execution on the GraphiQL side is the same as when running queries - the run-like button. You should get this result in the right pane: