How to get data from wildcard in firebase cloud functions

后端 未结 3 1415
时光说笑
时光说笑 2021-01-05 03:06

Assuming that I trigger events on the following ref(\'/users/{userId}/items/{newItem}\') I want to get a value from inside the wildcard userId

3条回答
  •  悲哀的现实
    2021-01-05 03:30

    In firestore you can use this.

    exports.getUser = functions.firestore
        .document('users/{userId}').onWrite((change, context) => {
            let userId = context.params.userId;
            //...
        });
    

提交回复
热议问题