Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug: Deleting record by ID #43

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ajithbhat
Copy link

This PR addresses the below issue:

Bug fix: Deleting a record by its ID

  • A bug was identified in the record deletion functionality where records could not be properly deleted by their ID.
  • I've implemented a fix to correctly delete records based on their ID, ensuring that the correct record is removed from the list.

@@ -39,7 +39,7 @@ const mutation = new GraphQLObjectType({
type: SongType,
args: { id: { type: GraphQLID } },
resolve(parentValue, { id }) {
return Song.findOneAndRemove(id);
return Song.findByIdAndRemove(id);
Copy link

@kbgar24 kbgar24 Apr 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great find/resolution! Ran into the same issue.

Minor: findByIdAndDelete appears to be faster & preferred by Mongoose documentation over findOneAndRemove

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants