Getting the user id from a Firestore Trigger in Cl

2020-01-24 05:19发布

In the example bellow, is there a way to get the user id (uid) of the user who wrote to 'offers/{offerId}'? I tried to do as described here but it doesn't work in Firestore.

exports.onNewOffer = functions.firestore
  .document('offers/{offerId}')
  .onCreate(event => {
    ...
});

7条回答
做个烂人
2楼-- · 2020-01-24 06:24

What is about snap._fieldsProto.uid.stringValue

Example:

exports.hello = functions.firestore.document('hello/{worldId}').onCreate((snap, context) => {
   console.log(snap._fieldsProto.uid.stringValue)
});
查看更多
登录 后发表回答