ng-pouchdb
ng-pouchdb copied to clipboard
Pouch Collection removeChild removes first in collection when no index found
When you have a collection with deleted items the removeChild function looks up the index but can return 'undefined'. In this case the call to collection.splice will remove the first item in the list which is not the desired behaviour.
I fixed it for me by checking on index before removing.
// Remove the item from the collection if (index) { collection.splice(index, 1); }