Firebase可以为手动添加的对象提供唯一的密钥吗?

时间:2017-08-01 13:25:19

标签: firebase firebase-realtime-database firebase-console

通过仪表板手动向Firebase数据库添加数据是否可以让Firebase为每个新对象提供唯一的密钥?

enter image description here

2 个答案:

答案 0 :(得分:5)

不,你不能。为此,您需要以编程方式使用with K.name_scope('CustomLayer'): # add first layer in new scope x = GlobalAveragePooling2D()(x) # add a second fully connected layer x = Dense(1024, activation='relu')(x) 方法。此方法将生成一个唯一的密钥,可以保存在数据库中,稍后在项目中使用。

有关将数据保存到Firebase数据库的信息,请参阅official documentation

希望它有所帮助。

答案 1 :(得分:0)

要创建随机生成的密钥,您需要使用childByAutoId() 这将返回您可以使用的Firebase参考,并将使用它返回密钥.key属性

let createAutoID = FIRDatabase.database().reference().child("orders").childByAutoId()

createAutoID.child("someOtherChild").setValue()

请参阅文档here

相关问题