本文整理匯總了TypeScript中@firebase/firestore-types.CollectionReference.doc方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript CollectionReference.doc方法的具體用法?TypeScript CollectionReference.doc怎麽用?TypeScript CollectionReference.doc使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類@firebase/firestore-types.CollectionReference
的用法示例。
在下文中一共展示了CollectionReference.doc方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: publishDocument
requirements.map(node => {
if (typeof node === "string") {
if (node.startsWith("subprograms")) {
// Resolve the subprogram.
return publishDocument(
this.subprogramsRef.doc(node.split("/")[1])
).pipe(
switchMap(result => {
if (!result) {
console.error("Could not resolve subprogram: " + node);
return of({ display: "Specification error" });
}
return this.resolve(JSON.parse(result.requirements)).pipe(
map(requirements => ({
display: result.display,
requirements
}))
);
})
);
} else {
return of(node);
}
} else if (node.requirements) {
return this.resolve(node.requirements).pipe(
map(requirements => ({ ...node, requirements }))
);
} else {
return of(node);
}
})
示例2:
/**
* Create a reference to a single document in a collection.
* @param path
*/
doc<T>(path: string): AngularFirestoreDocument<T> {
return new AngularFirestoreDocument<T>(this.ref.doc(path), this.afs);
}
示例3: randomName
Array.from(Array(numberOfItems)).forEach((a, i) => {
const name = randomName(firestore);
batch.set(collectionRef.doc(name), FAKE_STOCK_DATA);
names = [...names, name];
});