FieldValue undefined when using functions and Firestore

Here you can find the solution on github.

Using typescript with

"firebase-admin": "^11.0.0"
"firebase-functions": "^3.22.0"

you have to use

import { FieldValue } from 'firebase-admin/firestore'

Same for TimeStamp


It worked!

Require firebase-admin

const admin = require('firebase-admin')

Add this constant

const fieldValue = admin.firestore.FieldValue; 

Now use

fieldValue.delete()

For more reference : otcollect.com/post


Turns out it was a mistake in the documentation, the correct import should have been const FieldValue = require('firebase-admin').firestore.FieldValue;

Update

It should be said that Firebase responded within hours and are correcting the docs asap.