1

これは私の非常に基本的なクラウド機能ではありません:エラー:更新するエンティティ:アプリ - Firestoreクラウド機能

const functions = require('firebase-functions'); 
const admin = require('firebase-admin'); 
admin.initializeApp(functions.config().firebase); 
const db = admin.firestore() 

exports.createdNewAccount = functions.auth.user().onCreate(event => { 
    return db.collection('users').doc(event.data.uid).update({ 
     "creationDate" : Date.now() 
    }) 
}) 

そして私は私のコードが間違っている何

Error: no entity to update: app

エラーが出ますか?

答えて

5

おそらく、event.data.uidのドキュメントは存在しません。代わりに

The update will fail if applied to a document that does not exist.

使用set()update()状態のドキュメント。

+1

は、あなたが実際にマージして呼設定することをお勧めします - ドキュメントの例は次のとおりです。cityRef.set({ 資本金:真 }、{マージ:真}) –

+1

事がある、firebaseレッツ・一方、存在しない場合は、更新をファイヤーストアはしません... –

関連する問題