examples/quickstart4.js
function runProgramLogic() {
  var entries = db.getCollection("entries");
  var entryCount = entries.count();
  var now = new Date();

  console.log("old number of entries in database : " + entryCount);

  entries.insert({ x: now.getTime(), y: 100 - entryCount });
  entryCount = entries.count();

  console.log("new number of entries in database : " + entryCount);
  console.log("");
  
  // manually save
  db.saveDatabase(function(err) {
    if (err) {
      console.log(err);
    }
    else {
      console.log("saved... it can now be loaded or reloaded with up to date data");
    }
  });
}
function runProgramLogic() {
  var entries = db.getCollection("entries");
  var entryCount = entries.count();
  var now = new Date();

  console.log("old number of entries in database : " + entryCount);

  entries.insert({ x: now.getTime(), y: 100 - entryCount });
  entryCount = entries.count();

  console.log("new number of entries in database : " + entryCount);
  console.log("");
  
  // manually save
  db.saveDatabase(function(err) {
    if (err) {
      console.log(err);
    }
    else {
      console.log("saved... it can now be loaded or reloaded with up to date data");
    }
  });
}
function runProgramLogic ( ) { var entries = db . getCollection ( "entries" ) ; var entryCount = entries . count ( ) ; var now = new Date ( ) ; console . log ( "old number of entries in database : " + entryCount ) ; entries . insert ( { x : now . getTime ( ) , y : 100 - entryCount } ) ; entryCount = entries . count ( ) ; console . log ( "new number of entries in database : " + entryCount ) ; console . log ( "" ) ; // manually save db . saveDatabase ( function ( err ) { if ( err ) { console . log ( err ) ; } else { console . log ( "saved... it can now be loaded or reloaded with up to date data" ) ; } } ) ; }
place any bootstrap logic which needs to be run after loadDatabase has completed
place any bootstrap logic which needs to be run after loadDatabase has completed