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

375
Vistas
Get a Firestore document which matches as many values as possible?

I'm working on an app, which allows users to specify their skills and interests, and then get suggested jobs, based on their skills and interests.

Both are stored in a user document as an array:

skills: ['computers', 'blah-blah']

interests: ['whatever']

Each job is also stored in Firestore with a skills and an interests array (specified by the creator).

My question is, what would be the best way to find a job document which matches as many skills and interests as possible, based on the user making the request?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Just like what Frank and Dharmaraj already stated in the comments, I suggest that you further check the array-contains-any, for example:

import { query, where } from "firebase/firestore";  

const skillsQuery = query(skillsRef, 
  where('skills', 'array-contains-any', ['computers', 'blah-blah']));

const interestsQuery = query(interestsRef, 
  where('interests', 'array-contains-any', ['whatever', 'etc']));

Just note the following limitations of array-contains-any:

  • array-contains-any support up to 10 comparison values.
  • You can use at most one in, not-in, or array-contains-any clause per query. You can't combine these operators in the same query.
  • If you have more than 10 UIDs, you'll have to still do multiple queries and merge the results client-side.
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