Wie bekomme ich die server-timestamp in Cloud-Funktionen für die FB mit Firestore?

Wie können wir ein server-timestamp, ohne die Echtzeit-Datenbank
aber stattdessen Firestore ?

import * as functions from 'firebase-functions'
import { Firestore } from '@google-cloud/firestore'

const db = new Firestore()

export let testIfMatch = functions.firestore
        .document('users/{userId}/invites/{invitedUid}')
        .onCreate(event => {
            let invite = <any>event.data.data()

            if (invite.accepted == true) {
              return db.collection('matches').add({
                friends: [userId, invitedUid],
                timestamp: doc.readTime //<--- not exactly the actual time
              })
            }
InformationsquelleAutor Thomas | 2017-10-09
Schreibe einen Kommentar