Skip to content

Instantly share code, notes, and snippets.

@ShawonAshraf
Last active August 3, 2019 20:12
Show Gist options
  • Select an option

  • Save ShawonAshraf/2a1355ea5831d74a151e0949135a601e to your computer and use it in GitHub Desktop.

Select an option

Save ShawonAshraf/2a1355ea5831d74a151e0949135a601e to your computer and use it in GitHub Desktop.
Code for mongodb-nodejs-medium article
// filter
const filter = {
name: 'Red Dead Redemption 2',
platform: 'XBOXONE'
};
await deleteDoc(db, filter);
const deleteDoc = async(db, filter) => {
try {
await db.collection('games').findOneAndDelete(filter);
console.log('Document deleted...');
} catch (e) {
console.log(e.toString());
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment