From 8dacf1fc619b7ce6739939d37d2c4b8be433c01b Mon Sep 17 00:00:00 2001 From: Bill Hennessy Date: Sat, 16 Feb 2019 11:23:39 -0600 Subject: [PATCH] fix removeGadget replaced Gadget.findOneAndDelete with Gadget.findByIdAndDelete. findOneAndDelete deletes the first record regardless of what arguents are passed. --- graphql/mutations.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/graphql/mutations.js b/graphql/mutations.js index ecec47c..fd38ef4 100644 --- a/graphql/mutations.js +++ b/graphql/mutations.js @@ -54,7 +54,7 @@ const Mutation = new GraphQLObjectType({ id: { type: GraphQLString } }, resolve(parent, args) { - return Gadget.findOneAndDelete(args.id).exec() + return Gadget.findByIdAndDelete(args.id).exec() .then(gadget => gadget.remove()) .then(deletedGadget => deletedGadget) .catch(err => console.log(err)) @@ -63,4 +63,4 @@ const Mutation = new GraphQLObjectType({ } }) -module.exports = Mutation; \ No newline at end of file +module.exports = Mutation;