Skip to content

Instantly share code, notes, and snippets.

@ShawonAshraf
Created August 3, 2019 20:17
Show Gist options
  • Select an option

  • Save ShawonAshraf/4ed98efa0ffb9d2304896d73ad99f94d to your computer and use it in GitHub Desktop.

Select an option

Save ShawonAshraf/4ed98efa0ffb9d2304896d73ad99f94d to your computer and use it in GitHub Desktop.
Code for mongodb-nodejs-medium article
const searchInDb = async (db, searchQuery) => {
try {
const docs = await db.collection('games').find(searchQuery);
return docs.toArray();
} catch (e) {
console.log(e.toString());
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment