【发布时间】:2019-10-06 05:09:55
【问题描述】:
在监听新文档创建的函数中。你如何获得该文档的ID
export const createUser = functions.firestore
.document('users/{userId}/messages/{messagesID}')
.onCreate((snap, context) => {
// Get an object representing the document
// e.g. {'name': 'Marie', 'age': 66}
const newValue = snap.data();
// access a particular field as you would any JS property
const name = newValue.name;
// perform desired operations ...
});
我猜它在 context 参数中。我只是没有时间访问它
【问题讨论】:
标签: typescript firebase google-cloud-firestore google-cloud-functions