Skip to content

Changes from 1.4.x to 1.5.0

Rob Evans edited this page Nov 9, 2016 · 1 revision

The 1.5 release primarily focusses on enhancing the persistent storage plugin.

Changes to the plugin should not affect existing saved data and will hopefully continue to operate in the same way as you have previously experienced. The main differences are that the persistent storage will now save and load meta-data related to collections so that:

  • Calling db.load() will automatically find saved collections and load them without you having to declare them first via db.collection(). https://github.com/Irrelon/ForerunnerDB/issues/153 https://github.com/Irrelon/ForerunnerDB/issues/167
  • Calling db.save() or collection.save() will store data about the collection such as what indexes are set up on the collection. These are then used when loading data.
  • Data will now optimise based on the available storage so that if only localStorage is available then data will be stringified before save. If indexedDB is available then data will be stored in rows.

This release is still being worked on and may end up being deferred to version 2.0. Version 2.0 is a re-write of ForerunnerDB in ES6.

The ultimate goal is to make persistence work like any other database. Effectively it should work seamlessly with no need to be calling save() and load() calls. The issues around this are that many users don't need persistence so we still need to make sure the functionality is an optional plugin, which means we still need you to enable the functionality before it will work.

We are solving this by creating a new start method that you call to start persistence and once called (with a callback) you will no longer need to handle load and save manually.

It will look like this:

var fdb = new ForerunnerDB(),
    db = fdb.db('test');

db.persist.start(function () {
    // All data that was previously saved will now be available here

});