tdQrydxFvlyKFXpwwecqUbF
tdQrydeXpcqUbqweqwweqwF
tdQrydxFeXpcqqweqwwwUbe
tdQrydxFeqwewqwepcqUbF2
my_customer_id_1
my_customer_id_2
my_customer_id_3
my_customer_id_4
const _data = {
email: 'someemail',
uid:'some_uid',
first_name: 'some name',
last_name: 'some_last_name',
favorites: [],
shopping_cart: [],
history: [],
settings: {},
purchases: [],
created: 14753652226,
updated: 14753652226
}
this.add_new_user(_data).then( snap => { <=== this push documents with random names and i don wont that
console.log(snap);
}).catch ( error => {
console.log(error);
});
add_new_user(data:CustomerEntity, uid:String){
this.customers_collection = this.afs.collection('customers/' + uid);
return this.customers_collection.add(data);
}
当我获取数据时,这会给出这个输出
tdQrydxFvlyKFXpwwecqUbF: { <-- I dont want random Key ,I want to manualy set this key
email: 'someemail',
uid:'some_uid',
first_name: 'some name',
last_name: 'some_last_name',
favorites: [],
shopping_cart: [],
history: [],
settings: {},
purchases: [],
created: 14753652226,
updated: 14753652226
}
Lorem Ipsum只是印刷和排版行业的虚拟文本。自16世纪以来,Lorem Ipsum一直是业界标准的虚拟文本,当时一台未知的打印机采用了类型的厨房,并将其拼凑成一个类型的样本书。它不仅存在了五个世纪,而且还延续了电子排版,基本保持不变。它在20世纪60年代随着包含Lorem Ipsum段落的Letraset表格的推出而普及,最近还推出了包括Lorem Ipsum版本在内的桌面出版软件Aldus PageMaker
答案 0 :(得分:0)
因此,如果我从您的评论中得到了正确的答案,那么您需要:
在您的代码中,您实际上并没有将uid发送到add_new_user方法?所以,像:
add_new_user(data:CustomerEntity, uid:String)
{
this.customers_collection = this.afs.collection('customers').doc(uid);
return this.customers_collection.add(data);
}
然后是你的add_new_user方法
this.add_new_user(_data)
或离开
add_new_user(data:CustomerEntity)
{
this.customers_collection = this.afs.collection('customers').doc(data.uid);
return this.customers_collection.add(data);
}
喜欢它,并且做
{{1}}
如果有效。