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

129
Views
How do I interact with the Firestore database through the firebase admin?

I can't find the answer to this in the documentation. I have created a firebase cloud function which listens to the database and gets triggered when a doc in the database changes.

What I want the function to do is to gather information from the database, other than the information listened to in the first place, and then work with that information. How would I gather information from the Firestore database using firebase admin?

Down below is the code I have written so far:

exports.costCalculation = functions.firestore
  .document("questions/{docId}/post_publish_information/outcome_information")
  .onUpdate((change, context) => {
    const predictions = admin
      .firestore()
      .document("questions/{docId}/post_publish_information/predictions");
    console.log(predictions);
  });

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

The Admin SDK is already loaded and initialized, you just can't access it through the admin variable. If you don't feel like initializing an Admin SDK instance yourself, you can work from the document you get it from change.

For example, to get a reference to the predictions document you can also:

change.before.ref.parent.doc("predictions")
about 4 years ago · Juan Pablo Isaza Report
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!