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

280
Vistas
IndexedDB: SchemaError when trying to access nested object inside a table

I have an IndexedDB named pos and inside that table named pos_customers. The structure looks like https://imgur.com/e9ZrxVm

Now my goal is to access phone which is inside billing object. If you look closely, then billing object is nested. So, to access that I wrote this code:

if (search) {
database.table('pos_customers').where("first_name")
.startsWithIgnoreCase(search)
.or('email').startsWithIgnoreCase(search)
.or('billing.phone').startsWithIgnoreCase(search) //throws SchemaError
.toArray().then( (data) => {
    data.forEach(info => {
      for(let key in info) {
        console.log(`${key} ${info.email} ${info.billing.phone}`); //this will work obviously
        }
      }
)}
);

The warning it showed me:

Unhandled rejection: SchemaError: KeyPath billing.phone on object store pos_customers is not indexed.

Yes, I am new to Dexie and read many StackOverflow answers, but couldn’t get anything specific searching for Dexie nested objects.

Thank you in advance

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

0

I found a way to do this:

First, make sure the field you're trying to access is indexed properly: (Here billing.phone)

const tables = {
  pos_customers: 'id,first_name,last_name,email,username,billing,billing.phone,shipping,avatar_url,is_true'
}

Now, make sure to upgrade the version by incrementing the version value by +1.

database.version(2).stores( applyFilters( DATABASE_ADD_TABLES_FILTER, tables ) ); //previous version(1)

Now, go to the app on Chrome:

  1. Open Developer Tools (Ctrl+Shift+I / Cmd+Option+I)

  2. Go to Applications Tab, click on your target database and click on Delete database

  3. Hard Refresh the page and try whatever it is that you're trying to achieve.

It should work!

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