code: function flatten(obj) {
  	var flattenWorker = function(row, namespace, result) {
  		return _.reduce(row, function(result, value, key) {
  			var newKey;
  			newKey = "" + namespace + (namespace ? '.' : '') + key;
  			if (_.isPlainObject(value)) {
  				if (_.size(value)) {
  					flattenWorker(value, newKey, result);
  				}
  			} else {
  				result[newKey] = value;
  			}
  			return result;
  		}, result);
  	};
  	return flattenWorker(obj, '', {});
  }
docs: Take a nested object and return a flattened hash in Mongoose path notation
  e.g. {foo: {bar: 'baz'}} // Becomes {foo.bar: 'baz'}
  @param {Object} obj The object to flatten
  @return {Object} A flattened version of the object given