0

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.

Dharmaraj
  • 47,845
  • 8
  • 52
  • 84
Max
  • 488
  • 8
  • 19

1 Answers1

2

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.

Dharmaraj
  • 47,845
  • 8
  • 52
  • 84