Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jondthompson/c8e73ef45a1483f7b36e to your computer and use it in GitHub Desktop.
Save jondthompson/c8e73ef45a1483f7b36e to your computer and use it in GitHub Desktop.
var ref // Firebase ref to your list that has items with bad arrays in them.
var arrayToChange // String of the name of the property that contains the bad array.
ref.once("value", function(snapshot) {
snapshot.forEach(function(listItem){
var goodArray = $firebaseArray(listItem.ref().child(arrayToChange));
listItem.child(arrayToChange).forEach(function(arrayItem){
var arrayItemVal = arrayItem.val();
arrayItem.ref().remove();
goodArray.$add(arrayItemVal);
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment