On this occasion I try to obtain the largest number from a list of numbers on FB, that is, 1079.
and then increase 1 and thus continue with the correlative
this is for an order counter
when I run it in MITAI2Companion I get it immediately (OK)
When I run it in Emulator and also in Windows Subsystem it delays (DELAY)
I wanted to put a conditional "if it contains a number" to go to the next step
but count and keep running until you find the eldest
Or if there is another method, I would appreciate it. The idea is to have a correlative.
I had another look. You should using Firebase indexing and a Firebase query to return the largest value, get Firebase to do all the work for you. Firebase also has an increment function that you can call to add the next number.
There is no doubt that the web component is much faster than the FB when working with the Windows subsystem
The question is why it allows the search for the largest with only 5 items
and not with only 2
It is because it is a "fake" Firebase Array, and Firebase is confused.
If you do this
the query works OK, even if you only have one value in there.
If you use a real Firebase array, then the query still works, but returns the value in square brackets for items 0,1,2, then after that {"2":1555} format.
The best way to do this, in my opinion, is to post values, then you get a time based alpha-numeric key for each value
I wrote a small extension that generates these "push IDs", so if you want to upload a list of values to firebase, you can use this and then use a PATCH command to add the whole lot to your node.