Creating json objects with undefined properties
To make your code a bit more accurate you could run a function before every call to firebase (this is the main reason you need it) and create a new object with only defined props

function getDefinedProps(obj) {
  var o = {}
  for (key in obj) {
    if (obj[key] !== undefined)
      o[key] = obj[key]
  }

  return o;
}