1

We use the NoSQL database Firebase in our Dev shop, and we have user that is asking us to ensure that his name appears first in the list of contacts.

As firebase generates a random hash key when it inserts a value, I thought I would just manually change the respective entry to have it appear first.

As you can see from the screenshots below, the user John S. (who wishes to be the first contact in the field type filter), has a (manually modified) hash entry of -0AL. However as the 2nd screenshot shows, this is not working.

enter image description here

enter image description here

I know we can programatically do this by changing the data to also have orderId in it, but this is too big of a code change.

Any ideas to quickly solve this?

Derek

1 Answers1

0

The short answer is that you can't do this, as you cannot depend on the keyname. I need to create a sub-attribute and use firebase queries to pull and order the data appropriately.

I found this stack overflow link helpful: how to sort firebase auto generated key?