【发布时间】:2020-10-02 12:03:35
【问题描述】:
您好,我正在尝试读取我的 Firestore 数据库中的更改
'use stricts'
const functions = require('firebase-functions');
const admin = require('firebase-admin');
const nodemailer = require('nodemailer');
require('dotenv').config();
admin.initializeApp(functions.config().firebase);
exports.sendOrderCompletionEmail = functions.firestore.document('/service-requests/{req_id}')
.onUpdate((change, context) => {
const req = context.params.req_id;
const sts = change.after.val(); //Error on this line
console.log(sts);
});
我收到了这个错误
TypeError: change.after.val is not a function
我想读取文档中的更改并返回更改的字段值
【问题讨论】:
标签: javascript node.js firebase google-cloud-firestore google-cloud-functions