Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

374
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda