Firebase - 当我推送配置文件对象时,我想按 uid 推送。而不是默认给定的 id

Firebase - when I push a profile object, I want to push by uid. instead of the default given id

Firebase - 当我推送配置文件对象时,我想通过 uid 推送。而不是默认给定的 id。

我正在使用 angular2、typescript 和 firebase。

我有个人资料 json table。 配置文件 table 有一个配置文件列表。

我正在尝试添加配置文件对象。 我希望对象核心 ID 是 uid 而不是自动生成的 firebase id。

没有看到你的代码我不能做太多,但你需要使用 child 创建 id 然后设置对象。它会是这样的:

var ref = new Firebase('https://<YOUR-FIREBASE-APP>.firebaseio.com');
var profile = {
  id: 'your-own-id',
  name: 'Firebase'
};
ref.child('profiles').child(profile.id).set(profile);