techfort / LokiJS

javascript embeddable / in-memory database
http:/techfort.github.io/LokiJS
MIT License
6.73k stars 482 forks source link

incremental-indexeddb-adapter lokiid($loki) should start with 1 not 0 #937

Open gladjoyhub opened 1 month ago

gladjoyhub commented 1 month ago

src/incremental-indexeddb-adapter.js line 69 to 72

// chunkId - index of the data chunk - e.g. chunk 0 will be lokiIds 0-99
IncrementalIndexedDBAdapter.prototype._getChunk = function(collection, chunkId) {
// 0-99, 100-199, etc.
var minId = chunkId * this.chunkSize;

should be:

// chunkId - index of the data chunk - e.g. chunk 0 will be lokiIds 1-100
IncrementalIndexedDBAdapter.prototype._getChunk = function(collection, chunkId) {
// 1-100, 101-200, etc.
var minId = chunkId * this.chunkSize + 1;
radex commented 1 month ago

why is that?

gladjoyhub commented 1 month ago

integer primary key in various databases usually start with 1