Skip to content

Instantly share code, notes, and snippets.

@wojciech-bilicki
Created April 12, 2018 08:21
Show Gist options
  • Save wojciech-bilicki/d28e8d9c33054dbbf08f2fa7bf164c9d to your computer and use it in GitHub Desktop.
Save wojciech-bilicki/d28e8d9c33054dbbf08f2fa7bf164c9d to your computer and use it in GitHub Desktop.
update author
Mutation: {
addAuthor: (root, {name, age, Books}) => {
const author = new authorModel({name, age, Books})
return author.save()
},
deleteAuthor: (root, {id}) => {
return authorModel.findOneAndRemove({id: id})
},
updateAuthor:(root, {id, name})=> {
return authorModel.findOneAndUpdate({id:id}, {name})
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment