Closed vladar closed 3 years ago
Interestingly, if I first write to strKeys
and then to intKeys
- the error is gone:
strKeys.put(strKey, `${strKey}-value`)
lastPromise = intKeys.put(intKey, `${intKey}-value`)
Then if I try to read data from this store (after the workaround) I get unexpected keys. I expect sequential numbers from 0 to 99 but getting this:
16 0-value
20 2-value
276 4-value
532 8-value
788 16-value
1044 32-value
1300 64-value
65299 1-value
263444 65-value
525332 33-value
525588 66-value
787732 67-value
1049364 17-value
1049620 34-value
1049876 68-value
1312020 69-value
1573908 35-value
1574164 70-value
1836308 71-value
2097684 9-value
The reading script:
const { open } = require("lmdb-store")
const rootDb = open({
name: `root`,
path: `./data`,
keyIsUint32: false,
})
const intKeys = rootDb.openDB({
name: `intKeys`,
keyIsUint32: true,
})
const strKeys = rootDb.openDB({
name: `strKeys`,
keyIsUint32: false,
})
async function run() {
intKeys.getRange({ snapshot: false }).forEach(({ key, value }) => {
console.log(key, value)
})
}
run().catch(console.error)
Not sure if I am missing something or this is a bug.
Should be fixed in v1.2.4.
Yeah, works just fine with 1.2.4
. Thank you for the prompt fix!
I get the following error when trying to use
keyIsUint32
option:The example to reproduce it:
lmdb-store@1.2.3
v14.9.0