Skip to content

Fix bug: Deleting record by ID#43

Open
ajithbhat wants to merge 1 commit intoStephenGrider:masterfrom
ajithbhat:master
Open

Fix bug: Deleting record by ID#43
ajithbhat wants to merge 1 commit intoStephenGrider:masterfrom
ajithbhat:master

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.

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