1
新しく作成されたドキュメントの新しい属性を、onCreate()クラウドファイアストアトリガーによってトリガーされたクラウド関数で追加する方法。 クライアント側だけでなくサーバー側、つまりクラウド機能で文書を更新するのに同じアプローチを使用できますか? the docsパーGoogle Cloud Firestoreトリガー
新しく作成されたドキュメントの新しい属性を、onCreate()クラウドファイアストアトリガーによってトリガーされたクラウド関数で追加する方法。 クライアント側だけでなくサーバー側、つまりクラウド機能で文書を更新するのに同じアプローチを使用できますか? the docsパーGoogle Cloud Firestoreトリガー
、あなたが操作を実行するためにevent.data.ref
を使用することができます。
exports.addUserProperty = functions.firestore
.document('users/{userId}')
.onCreate(event => {
// Get an object representing the document
// e.g. {'name': 'Marie', 'age': 66}
var data = event.data.data();
// add a new property to the user object, write it to Firestore
return event.data.ref.update({
"born": "Poland"
});
});
私は、ドキュメントID –
を知らないので、私は、特定のドキュメントのパスを追加する方法documents.Thenのための自動生成されたIDの選びましたこれは、ワイルドカード '{wildcardId}'のためのものです。その場所のすべての変更を取得します。 –