IndexedDB Count Records by Service ID and Status
To get the count of matching records instead of retrieving all the records, you can use the 'count()' method instead of 'getAll()'. Here's the modified code:
dbo.transaction(['orders'], 'readonly')
  .objectStore('orders')
  .index('serviceid, status')
  .count([window['serviceid'], 0]);
This will return the count of records that match the given '[serviceid, status]' criteria.
原文地址: https://www.cveoy.top/t/topic/o2px 著作权归作者所有。请勿转载和采集!