forest-fire / firemock

Firebase 3.0 mocking and mock generation all with Typescript typings
https://www.firemock.com/
MIT License
6 stars 5 forks source link

m.ref(endPoint).once('value') retrieves data in reverse order (Last in Last out) contrary to firebase realtime database data retrieval model (First in First out - Queue) #5

Open joshuapro14 opened 5 years ago

joshuapro14 commented 5 years ago

Thanks for writing a wonderful API; I was trying to use it in my test scenarios to mock communications to firebase realtime database.

I have found that retrieval of collection from an end point using once('value') retrieves data in reverse order (Last in Last out - stack) instead of First in First out (Queue).

yankeeinlondon commented 4 years ago

Good catch; sorry I didn't see this issue until now. I am wondering if you have a list of values why not use a child listener? This is more typical. In JS -- strictly speaking -- there are no guarentees of a "natural sort order" to objects though many/most implementations return based on the order of the keys (which of course holds meaning in Firebase).