dndb icon indicating copy to clipboard operation
dndb copied to clipboard

Cannot load multiples instance if db files needs to be created

Open lowlighter opened this issue 4 years ago • 0 comments

It seems it is not possible to use multiple instances at once when files needs to be created:

import Datastore from 'https://deno.land/x/[email protected]/mod.ts'

const a = new Datastore({filename:"a", autoload:true})
const b = new Datastore({filename:"b", autoload:true})
console.log(await b.findOne({}))

Will result in:

error: Uncaught (in promise) NotFound: The system cannot find the file specified. (os error 2)
    const file = await Deno.open(this.filename);

Running it twice (i.e. when "a" file is already created) will work.

deno 1.11.2 (release, x86_64-pc-windows-msvc)
v8 9.1.269.35
typescript 4.3.2

lowlighter avatar Jun 26 '21 13:06 lowlighter