function databaseInitialize() {
  var entries = db.getCollection("entries");
  var messages = db.getCollection("messages");

  // Add our main example collection if this is first run.
  // This collection will save into a partition named quickstart3.db.0 (collection 0)  
  if (entries === null) {
    // first time run so add and configure collection with some arbitrary options
    entries = db.addCollection("entries");
  }

  if (messages === null) {
    messages = db.addCollection("messages");
    messages.insert({ txt: "i will only insert into this collection during databaseInitialize" });
  }
}
quickstart4.js example for lokijs with manual loading and saving

This example shows how you can manually load and save your loki 
database if do not need or want to use the 'autosave' functionality.

Since most of loki's persistence adapters are asynchronous this example
shows you still need to use the appropriate callbacks to ensure those 
processes complete before you reload.