googlearchive / firebase-util

An experimental toolset for Firebase
http://firebase.github.io/firebase-util
MIT License
276 stars 67 forks source link

Error using orderByValue() on NormalizedCollection #32

Closed michaeldim closed 9 years ago

michaeldim commented 9 years ago

Related to: #28, I can't seem to apply a query on the master index using the orderByValue() method. An 'undefined is not a function' error is returned, http://plnkr.co/edit/HaA1lz

fdidron commented 9 years ago

I think you should use orderByChild() instead.

michaeldim commented 9 years ago

There aren't any children to order by in the master index.

katowulf commented 9 years ago

Note that you can use orderByValue() on the master ref (e.g. fb.child('event1').orderByValue()) before passing it into NormalizedCollection to achieve the same effect and improve efficiency.

michaeldim commented 9 years ago

@katowulf Once the NormalizedCollection is added, even if orderByValue() is passed in the master ref it still doesn't order correctly. http://embed.plnkr.co/VP9k55/preview. I'm not particularly concerned now you have added a fix, but I thought it worth mentioning.

katowulf commented 9 years ago

Will be fixed soon, probably today. orderByValue() on the master ref achieves the same effect.

michaeldim commented 9 years ago

OK thanks.

michaeldim commented 9 years ago

@katowulf Using the master branch 948cc685e01baf19a32832f44f14053818609ce5, queries still don't appear to be working on the index ref, http://plnkr.co/edit/GR6iAo?p=preview

katowulf commented 9 years ago

@michaeldim The title of this issue is "Error using orderByValue()"; I don't see that error being thrown in your plunker. Although I do see that limitToFirst() isn't working (which sounds like a new issue).

michaeldim commented 9 years ago

Ok ill open up a new issue for limitToFirst(). Although orderByValue() is not sorting the data in the correct order.

katowulf commented 9 years ago

Also not the problem described here, but probably worthy of an issue.