database.js
// when patient ID is changed, all entries must be updated
when patient ID is changed, all entries must be updated
when patient ID is changed all entries must be updated
function updateEntries(oldId, newId) {
  var results = entries.chain().find({'pid':oldId}).data();
  for(var i = 0; i < results.length; i++) {
    results[i].pid = newId;
  } 
  entries.update(results);
}
function updateEntries ( oldId , newId ) { var results = entries . chain ( ) . find ( { 'pid' : oldId } ) . data ( ) ; for ( var i = 0 ; i < results . length ; i ++ ) { results [ i ] . pid = newId ; } entries . update ( results ) ; }
when patient ID is changed, all entries must be updated
when patient ID is changed all entries must be updated