This function is in Cloud Functions, I would like to know how I can get only one field of a specific document, and not just fetch all document data. My Code:
export const onNewOrder = functions.firestore.document("/orders/{orderId}").onCreate(async (snapshot, context) => {
const orderId = context.params.orderId;
// Where do I specify the data from which field I want to fetch?
const snap = await admin.firestore().collection("orders").doc(orderId).get();
console.log(snap.data());
});
Where do I specify the data from which field I want to fetch?