TransWikia.com

JavaScript async/await function performance improvement

Code Review Asked by nmsdvid on January 14, 2021

I have a simple async/await function which gets data from a firebase endpoint. I would like to know if there is any room for improvement performance wise.

async function getDataById(id) {
  const snapshot = await admin
    .firestore()
    .collection("collection")
    .where("id", "==", id)
    .get();
  const documents = [];
  snapshot.forEach((doc) => {
    documents.push(doc.data());
  });
  return documents;
}

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP