使用documentRef

时间:2018-09-13 13:11:21

标签: google-cloud-firestore angularfire2

我想将带有documentReference的文档保存为属性。 我找不到方法。

我尝试了以下操作:

import { DocumentReference } from 'angularfire2/firestore';

export interface ParticipantDto {
    nickname: string;
    character: DocumentReference;
    email: string;
}

const toSave = {
  nickname: participantToSave.nickname,
  email: participantToSave.email,
  character : {
    firestore: this.firestore,
    id: participantToSave.character.id,
    path: 'characters',
    parent: this.participantsCollection
   }
};
this.participantsCollection.add(toSave);

但是我无法构建DocumentReference,我创建的对象无法分配给文档引用。

有人通过代码来实现这一目标吗?

0 个答案:

没有答案
相关问题