Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

277
Views
What's the setup and syntax for using a Firestore server method in a Firebase Function

https://firebase.google.com/docs/firestore/manage-data/add-data#update_elements_in_an_array

Specifically, I need to use firebase.firestore.FieldValue.arrayUnion("greater_virginia") to update an array.

Firebase (v8) functions is setup with:

const admin = require('firebase-admin')
admin.initializeApp()
const db = admin.firestore()

module.exports = { admin, db }

Using it as written in the docs returns "ReferenceError: firebase is not defined".

Using db.FieldValue... returns "TypeError: Cannot read property 'arrayUnion' of undefined".

I don't have a whole lot of flexibility for wholesale change of the config, but I can modify some things.

How should I set this up so that I can use that firestore method?

about 4 years ago · Santiago Gelvez
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!