Below stopped working after moving from version ^10.0.2
to ^11.2.0
of firebase-admin
.
import { firestore } from 'firebase-admin';
const serverTimestamp = firestore.FieldValue.serverTimestamp()
How should it be done now? Can't find any documentation on it.
CodePudding user response:
You can import FieldValue
from Firestore SDK as shown below:
import * as functions from "firebase-functions";
import { initializeApp } from "firebase-admin/app";
import { FieldValue, getFirestore } from "firebase-admin/firestore";
initializeApp();
const serverTimestamp = FieldValue.serverTimestamp();
The API reference can be found here.