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

189
Views
Bulk way to determine of all paths, which one exists (Possibly in one API Call)

I have an array of strings and want to check which of all those documents exist in my Firestore in two ways:

I am using Node Admin SDK:

import Server from '../../../../firebase/firebase_server_exports';

export const databaseEntryExists = async (paths: string[]): Promise<string> => {
  const promises = paths.map(
    (element) =>
      new Promise((resolve) => {
        Server.db
          .doc(element)
          .get()
          .then((doc) => resolve(doc.exists ? element : ''));
      })
  );
  const results = await Promise.all(promises);
  return results.includes(true) ? paths[results.indexOf(true)] : '';
};

Though this method works nicely, if I have 100 paths, I will be making 100 API calls which doesn't sound a good deal to me. Can someone suggest any Fierstore utility function or something like batch document fetching in order to reduce this to one API call?

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

0

In the Node.js SDK, you can create DocumentReference objects for all IDs and then use getAll() to get them all in one go. See the documentation for getAll() for an example.

This call does not exist in the client-side SDKs though, so the closest you can get there is to combine up to 10 IDs in a single call by querying on FieldPath.documentId() and using the in operator. There is nothing to request

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!