Created
October 25, 2015 16:06
-
-
Save jondthompson/c8e73ef45a1483f7b36e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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