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

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

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