0

My data structure is like this:

[{
"IdFrete":7,
"Descricao":"Frete XYZ",
"PrazoEntrega":"(Até 10 dias)",
"DescricaoArea":"TO",
"CepInicio":77000000,
"CepFim":77999999,
"PesoIni":0,
"PesoFim":5000,
"Valor":80
},{
"IdFrete":7,
"Descricao":"Frete XYZ",
"PrazoEntrega":"(Até 10 dias)",
"DescricaoArea":"SP",
"CepInicio":1000000,
"CepFim":19999999,
"PesoIni":0,
"PesoFim":5000,
"Valor":80
}]

I need make a select by interval of CepInicio and CepFim and interval of PesoIni and PesoFim. Something like in SQL: Select * from table where (CepInicio>=14100500 and CepFim <=14100500) and (PesoIni>=500 and PesoFim <=500)

I tried to create array index: tb.createIndex('searchFreteIdx', ['IdFrete', 'CepInicio', 'PesoIni', 'CepFim', 'PesoFim'], {unique:false,multiEntry: true});

But I believe that's wrong. And can't find any sample to construct this index

  • This is basically the same as these questions: https://stackoverflow.com/questions/21731347/indexeddb-idbkeyrange-compound-multiple-index-not-working https://stackoverflow.com/questions/16522115/indexed-db-cursor-ranges-on-multiple-properties To query over multiple properties simultaneously requires either advancing a single cursor and skipping over gaps, or iterating several cursors in parallel. It's unfortunately rather complicated. – Joshua Bell Apr 06 '23 at 16:19

0 Answers0