當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript firestore-types.CollectionReference類代碼示例

本文整理匯總了TypeScript中@firebase/firestore-types.CollectionReference的典型用法代碼示例。如果您正苦於以下問題:TypeScript CollectionReference類的具體用法?TypeScript CollectionReference怎麽用?TypeScript CollectionReference使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了CollectionReference類的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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);
   }
 })
開發者ID:kevmo314,項目名稱:canigraduate.uchicago.edu,代碼行數:31,代碼來源:program.ts

示例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);
 }
開發者ID:juampi,項目名稱:angularfire2,代碼行數:7,代碼來源:collection.ts

示例3: randomName

 Array.from(Array(numberOfItems)).forEach((a, i) => {
   const name = randomName(firestore);
   batch.set(collectionRef.doc(name), FAKE_STOCK_DATA);
   names = [...names, name];
 });
開發者ID:acipher,項目名稱:angularfire2,代碼行數:5,代碼來源:utils.spec.ts

示例4: add

 /**
  * Add data to a collection reference.
  *
  * Note: Data operation methods are done on the reference not the query. This means
  * when you update data it is not updating data to the window of your query unless
  * the data fits the criteria of the query.
  */
 add(data: T): Promise<DocumentReference> {
   return this.ref.add(data);
 }
開發者ID:juampi,項目名稱:angularfire2,代碼行數:10,代碼來源:collection.ts

示例5:

 const observable = Observable.create(observer =>
   ref.onSnapshot(observer)
開發者ID:kevmo314,項目名稱:canigraduate.uchicago.edu,代碼行數:2,代碼來源:publishIndex.ts


注:本文中的@firebase/firestore-types.CollectionReference類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。