如何排序firebase自动生成的密钥? [英] how to sort firebase auto generated key?

查看:69
本文介绍了如何排序firebase自动生成的密钥?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Firebase实时数据库.每次我使用push方法将数据推送到firebase中时,它都会自动生成这样的密钥 据我所知,-L1GgaMStpwEV4N3sQad"也是基于时间生成的.

I am working with firebase real time database. Every time I push the data into the firebase using push method it auto generates a key like this "-L1GgaMStpwEV4N3sQad" to my best knowledge it's generated based on time also.

所以我的问题是,有什么办法可以对密钥asce或desc进行排序?

So my question is there any way to sort the key asce or in desc?.

我已附加自动生成的Firebase图像.

I have attached image of firebase auto generated.

谢谢.

推荐答案

我是Firebase的新手,但这是我的观察结果: 生成的唯一键已经按字典顺序排序. 仔细看看您的对象: -L1GgaM对于所有键都是通用的(最后一个以'N'结尾的键除外)

I new to firebase but here's my observation : The unique keys that are generated are already sorted in Lexicographical order. Have a closer look at your objects: -L1GgaM is common for all keys (except last which ends with 'N')

另外,请记住,大写字母的ASCII值比对应的大写字母低.

Also, remember that capital letters have lower ASCII value than their counterpart.

这篇关于如何排序firebase自动生成的密钥?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆