0
しばらくの間この問題に固執していましたので、私がしたいのはこれです: フォームを作成するときに、フォームを作成するときに、ユーザのリストと共に電子メールアドレス - このような:Firebaseにネストされたオブジェクトを挿入します
formsById - >フォームID - >のuserId(ユーザーの電子メールアドレスが含まれています)
私は、このような現在のユーザーがフォームのすべてをフィルタリングすることができます。
getFormList() {
return firebase.database().ref('/formsByID').orderByChild('userList').startAt(this.userId).endAt(this.userId);
}
私は現在データベースにどのように書き込むのですか:
writeNewForm(formName: string, formDate: string): Promise<any> {
// A post entry.
let postData = {
name: formName,
date: formDate,
userList: this.userId // I want to nest the email in here
};
// Get a key for a new Post.
let newPostKey:string = this.formListRef.push().key;
// Write the new post's data simultaneously in the posts list and the user's post list.
let updates = {};
// write to the users record
updates[this.userPath + '/' + newPostKey] = true; // just set this to true be
updates[this.formsByIdPath + '/' + newPostKey] = postData;
return this.rootRef.update(updates);
//return rootRef.update(updates);
}
しかし、自分のユーザーIDで自分のユーザーの電子メールアドレスをネストする方法はわかりません。
助けてください。
パーフェクト - あなたに感謝 – rhysclay