V-Play has a new name, say hi to Felgo!Learn More

Forums

OverviewFelgo Plugins Support › Firebase orderByChild result is not ordered due to javascript object conversion

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #20269

    Furkan

    Hi there,

    When I query Firebase database by using db.getValue(…) or db.getUserValue(…) functions with orderByChild parameter the returned value looks like it is not sorted. Schema is like below:

    + addresses

    –  -LN0JJpV0r1dZbraSYrH

    –     name: “abc”

    db.getUserValue("addresses", { orderByChild: "name"}, function(success, key, value) { ... }

     

    Problem is due to the fact that “value” passed to the callback function is already a javascript object and when javascript converts data to object its sorting is redesigned arbitrarily by javascript engine. So, Firebase returns the data in required order, however, Javascript loses the returned order by mixing things up.

    • Is there a way to get the data with its correct order without making changes in the database schema with current implementation of Felgo Firebase plugin?
    • Is there a way to incorporate “child_added” callback style where callback function is called per each key returned from the query? Currently the whole query is returned as an object in a single callback function call.

    Best

    Furkan

     

     

    #20275

    Alex
    Felgo Team
Viewing 2 posts - 1 through 2 (of 2 total)

RSS feed for this thread

You must be logged in to reply to this topic.

Voted #1 for:

  • Easiest to learn
  • Most time saving
  • Best support

Develop Cross-Platform Apps and Games 50% Faster!

  • Voted the best supported, most time-saving and easiest to learn cross-platform development tool
  • Based on the Qt framework, with native performance and appearance on all platforms including iOS and Android
  • Offers a variety of plugins to monetize, analyze and engage users
FREE!
create apps
create games
cross platform
native performance
3rd party services
game network
multiplayer
level editor
easiest to learn
biggest time saving
best support