How to pass admin.firestore.FieldValue.serverTimestamp() to the update() method, using CloudFunction coded in TypeScript

前端 未结 2 903
离开以前
离开以前 2020-12-21 15:45

How to pass admin.firestore.FieldValue.serverTimestamp() to the update() method? I want to insert this in an array, like this:

import * as functions from \'         


        
2条回答
  •  无人及你
    2020-12-21 16:03

    Instead of admin.firestore.FieldValue.serverTimestamp(), you can use admin.firestore.Timestamp.now()

    const time = admin.firestore.Timestamp.now();
    await amisA.update({
            [`amis.${numeroSender}`] : 
               {
        connaissanceABBA: connaissanceABBA,
        version: version,
        ts: firebase.firestore.FieldValue.serverTimestamp()
      }
    });
    });
    

提交回复
热议问题