Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firebase: .priority value

Tags:

firebase

  • How do I check the .priority values are in my "Forge"?
  • According to docs, smaller .priority value comes before larger .priority value. If I use seconds since epoch for priority, and I want the latest children to show up on top, should I set .priority to be 1/seconds?

Children with a number as their priority come next. They are sorted numerically by priority (small to large) and then lexicographically by name (a to z).

  • From experimentation, I've determined that if I set .priority to java.util.Date#getTime, oldest children show up on top in my Forge, but latest children show up on top in my Javascript on() when ranking using prevChildName. Why is this?
like image 928
real Avatar asked Apr 01 '13 07:04

real


2 Answers

You can see .priority in a json by "Export JSON" from the Forge.

like image 93
hiroshi Avatar answered Oct 11 '22 05:10

hiroshi


use

snapshot.getPriority();

more at https://www.firebase.com/docs/javascript/firebase/setwithpriority.html

like image 23
Zakari Avatar answered Oct 11 '22 05:10

Zakari