News for hackers. Stuff that matters.
Re:LowDB – A flat JSON file database by blablabla123 on Friday August 22, 2014 @07:06AM (#8211597)
I think the idea is cool, actually I once worked on something similar in Go, very small code base. And adding flushing, caching and thread-safety is no black art. The charming thing here is that, once severe Data errors happen, one can easily recover from them using a simple Editor.

Imagine how to fix low-level data corruption on your <Insert your DBMS name> Server.

Re:LowDB – A flat JSON file database by couchand on Friday August 22, 2014 @09:12AM (#8211914)
once severe Data errors happen, one can easily recover from them using a simple Editor.

Unfortunately, in this case, you can't necessarily. One of the issues here is that holding on to handles to multiple collections doesn't do what it seems to, and also doesn't fail. Try running this:

    var low = require('lowdb');

    var foo = low('foo');
    low('bar');

    low.on('add', function(collection) {
        console.log("this should be foo:", collection);
    });

    foo.insert({ name: 'foo' });
Re:LowDB – A flat JSON file database by typicode on Friday August 22, 2014 @06:21PM (#8214220)
Actually, in my code I always start with low():

  low('foo').insert({ name: 'foo' })
  low('bar').insert({ name: 'bar' })
  low('foo').insert({ name: 'foo' })
So never really considered this way of writing or had this bug.

But I can see that it's a flaw and unexpected behavior. I'm adding this to the enhancements for the next version.

Thanks for spotting it :)

Re:LowDB – A flat JSON file database by typicode on Thursday September 04, 2014 @07:30PM (#8271317)
Just a little update. I've released LowDB 0.4.0 which is a complete rewrite of the project.

It fixes some initial flaws/bugs and includes some new features. Also, writing is now fault-tolerant and fully asynchronous.