Closed orangecoding closed 1 year ago
Hi,
You need to call .value()
at the end of lodash chain
I did that and it still does not write anything to the file.
db.chain.set("someKey", someValue).value();
db.write();
Complete Example:
import { JSONFileSync } from 'lowdb/node';
import { getDirName } from '../../utils.js';
import path from 'path';
import LowdashAdapter from './LowDashAdapter.js';
const file = path.join(getDirName(), '../', 'db/listings.json');
const adapter = new JSONFileSync(file);
const db = new LowdashAdapter(adapter);
db.read();
(...)
db.chain.set("someKey", someValue).value();
db.write();
ok sry, I did something wrong. works now.
Hi,
If I'm building a class extending LowSync to use LowDash, writing the actual content to the file doesn't work anymore.
This is an example of how I write data.