What's an effective way to turn this:
{
  person:{
    name:'John',
    address:{
      city:'England',
      street:'99',
    }
  }
}
Into this:
{
  'person.name' :'John',
  'person.address.city':'England',
  'person.address.street':'99'
}
Thanks! Ps. I need it for updating mongo documents with multiple fields at the time without replacing the whole objects (using $set).
 
    