Starting in lmdb-js v 2.1.1 if you wrap the results of lmdb.open in an async function the returned value is a Boolean of true instead of the environment reference.
This will cause the bad behavior:
'use strict';
const lmdb = require('lmdb');
async function createEnv() {
let env_init = {
"path": './data',
};
let my_env = lmdb.open(env_init);
console.log(my_env.constructor.name);
return my_env;
}
(async ()=> {
let my_env = await createEnv();
console.log(my_env.constructor.name);
})();
Result from this is:
LMDBStore
Boolean
This synchronous code works fine:
'use strict';
const lmdb = require('lmdb');
function createEnv() {
let env_init = {
"path": './data',
};
let my_env = lmdb.open(env_init);
console.log(my_env.constructor.name);
return my_env;
}
(async ()=> {
let my_env = createEnv();
console.log(my_env.constructor.name);
})();
Starting in lmdb-js v 2.1.1 if you wrap the results of lmdb.open in an async function the returned value is a Boolean of true instead of the environment reference.
This will cause the bad behavior:
Result from this is:
This synchronous code works fine:
Returns: