Updating nested objects firebase

This question provides a more recent solution that works with cloud firestore.

Rather than using "/", one may use "." instead:

var userRef = ref.child(hashedEmail);
var updateObject = {
   name: 'Rohan Dalvi', 
   "externalLinks.website": 'mywebsite'
};
userRef.update(updateObject);

You can use multi-path updates.

var userRef = ref.child(hashedEmail);
var updateObject = {
   name: 'Rohan Dalvi', 
   "externalLinks/website": 'mywebsite'
};
userRef.update(updateObject);

By using the "externalLinks/website" syntax in the object literal it will treat the nested path as an update and not a set for the nested object. This keeps nested data from being deleted.