Tip: sorting is disabled by default in queries

Options

Hey gang, I watched this video on accessing arrays within arrays by using an index. Unfortunately, queries performed around my implementation of this pattern were not sorted by default, resulting in unpredictable behavior when "set"-ing and "get"-in by index. This (see the video) was a powerful feature, b/c of how often accessing arrays within arrays comes-up, but please be aware that for predictable usage, you likely want (like I assumed was default) queries to be sorted by ID throughout. I was overwriting adjacent and random entries by relying on the index. (you'll see "sort" under output of the query function). Apologies if this has been covered.

Comments

  • Liz Anaya
    Liz Anaya Member, Administrator

    ADMIN

    Options

    Hey @Xanoguy! 👋

    Thank you so much for providing this tip for the community!

    I created this GIF to showcase what you explained above:

    I'll address this with the team to ensure that we provide clear information and make it more apparent that sorting is turned off by default. 😊

  • Xanoguy
    Xanoguy Member
    Options

    Thanks Liz. In retrospect I may have had a pretty "edge" use case, in terms of relying on a query to then use findbyindex, but glad I was able to find the option and figure out what was going on. Thx.