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

373
Views
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 answers
Answer question

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 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!