Spring Boot MongoDB GraphQL Tutorial


GitHub Repository

Spring Boot MongoDB GraphQL


Prerequisites For Running Application

1-run mongo db on default port (27017)

2-set your profile to test.

3-run the application from GraphQLApplication.


GraphQL sample queries

Singers Query

{
  singers{
    id
    name
    age
    gender
    thumbnail
    musics {
      genre
      instrument
    }
  }
}
{
  getSingers(singerId:"62e761f3c2966a324f433a4d"){
    id
    name
    age
    gender
    thumbnail
    musics {
      genre
      instrument
    }
  }
}

Musics Query

{
  getSingerMusics(singerId:"62e761f3c2966a324f433a4d"){
    genre
    instrument
    chord
  
  }
}

Mutation

mutation{
  singerPersistence(name:"tyga",age:24,gender:"male"){
    id
    name
    age
    gender
  }
}