Get Number of records

I’m using a direct connection to Firebase.
I have a field called order. En by default I want to fill this field with the number of records in the table + 1

How do I get a record count?

Alternative is to get the highest order from the query and + 1