Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

194
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda