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

461
Vistas
Firestore: Inequality filter property and first sort order must be the same. Failing where condition and order in different fields. Is this Expected?

I have a collection of documents like this:

{
   uid: <UNIQUE_USER_ID>,
   lastLoggedIn: <TIMESTAMP_IN_NUMBER>,
   ...
}

when I try to fetch the data using:

Server.db
    .collection(firebasePaths.funfuse_verified_users)
    .where('uid', 'not-in', notToIncludeAccounts)
    .orderBy('lastLoggedIn', 'desc')
    .startAt(startAt)
    .limit(limit)

I get an error saying:

Error: 3 INVALID_ARGUMENT: inequality filter property and first sort order must be the same: uid 
and lastLoggedIn

Is this a known limitation of firebase or am I doing something wrong ? I want to query all the users which aren't in an array using not-in and then sort those results based on lastLoggedIn timestamp activity.

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

0

As the error message says, in order to be able to use not-in you must first order on the same field:

Server.db
    .collection(firebasePaths.funfuse_verified_users)
    .orderBy('uid')
    .where('uid', 'not-in', notToIncludeAccounts)
    .orderBy('lastLoggedIn', 'desc')
    .startAt(startAt)
    .limit(limit)

This also means that the results will be order first on uid and only then (so if there are multiple results with the same uid value) on lastLoggedIn. If you need them in another order, you will have to resort them in your application code.

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