您好,我正在尝试读取我的 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
我想读取文档中的更改并返回更改的字段值