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

113
Vistas
Operate multiple in operations in Firestore. Any hack possible?

I want to query on multiple fields based on multiple in conditions as shown below:

db
    .collection(firebasePaths.funfuse_verified_users)
    .orderBy('uid')
    .where('uid', 'not-in', notToIncludeAccounts)
    .orderBy('skills')
    .where('skills', 'in', skills)
    .orderBy('interests')
    .where('interests', 'in', interests)

Firestore limitation states that only one in is allowed per query but I was interested in knowing if by some hacky way can I make this work? One thing I thought of is to fetch the two results and then take the intersection of those but this would mean a lot of load on my backend. Is there some other way that I am not aware of which could be used for such scenarios? I want to filter the database based on skills and interest arrays.

Edit 1: Added Document Example Example of the document will be something like this:

{
      "name": "Shivam",
      "online": true,
      "bio": "",
      "skills": [
        "Supply Chain",
        "Inventory Management",
        "Legal",
        "Digital Marketing",
        "Web"
      ],
      "interests": [
        "Healthcare"
      ],
      "imageLoc": "profile-pics/profile-photo",
      "isImageAvailable": true,
      "uid": "",
      "username": "tttt"
    },

Expected query:

db
    .collection(firebasePaths.funfuse_verified_users)
    .orderBy('uid')
    .where('uid', 'not-in', ['1','2'])
    .orderBy('skills')
    .where('skills', 'in', ["Supply Chain","Inventory Management"])
    .orderBy('interests')
    .where('interests', 'in', ["Supply Chain","Inventory Management"])

Something like this.

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

0

There is nothing hidden in the API to allow the use-case, so any workaround will have to come from changes to the data model.


The best I can think of is to add an additional field that combines the skills and interests values, and filter on that.

If you just add all the individual values ("skills_and_interests": ["Supply Chain", "Inventory Management", "Legal", "Digital Marketing", "Web", "Healthcare"]), you can do the equivalent of an OR operation on that with in. If you want to be able to distinguish skills from interesting, you could prefix the values ("skill_Supply Chain", "interest_Healthcare").

If you want to filter on combined values, you'd have to add the combinations of skills and interests (e.g. "Supply Chain_Healthcare", "Inventory Management_Healthcare"), so that you can then do an AND like operation.

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