From 280c6b6e758396e146267170947675b5e73c014e Mon Sep 17 00:00:00 2001 From: David East Date: Wed, 12 Jul 2023 19:38:32 +0000 Subject: [PATCH] change docs and tests --- docs/firestore.md | 22 +++++++++++----------- test/firestore-lite.test.ts | 8 ++++---- test/firestore.test.ts | 8 ++++---- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/docs/firestore.md b/docs/firestore.md index dd08859..95ca722 100644 --- a/docs/firestore.md +++ b/docs/firestore.md @@ -231,29 +231,29 @@ deleteDoc(davidDocRef); */ ``` -### `collectionCount$()` +### `collectionCount()` Create an observable that emits the server-calculated number of documents in a collection or query. [Learn more about count queries in the Firebase docs](https://firebase.google.com/docs/firestore/query-data/aggregation-queries). | | | |-----------------|------------------------------------------| -| **function** | `collectionCount$()` | +| **function** | `collectionCount()` | | **params** | query: `import('firebase/firestore').CollectionReference \| import('firebase/firestore').Query`| | **import path** | `rxfire/firestore` or `rxfire/firestore/lite` | | **return** | `Observable` | #### TypeScript Example ```ts -import { collectionCount$ } from 'rxfire/firestore'; +import { collectionCount } from 'rxfire/firestore'; // Also available in firestore/lite -import { collectionCount$ } from 'rxfire/firestore/lite'; +import { collectionCount } from 'rxfire/firestore/lite'; import { getFirestore, collection } from 'firebase/firestore'; const db = getFirestore(); const likesCol = collection(db, 'posts/post_id_123/likes'); -collectionCount$(likesCol).subscribe(count => { +collectionCount(likesCol).subscribe(count => { console.log(count); }); ``` @@ -263,13 +263,13 @@ Note that the observable will complete after the first fetch. This is not a long ```ts import { repeat } from 'rxjs'; -import { collectionCount$} from 'rxfire/firestore'; +import { collectionCount} from 'rxfire/firestore'; import { getFirestore, collection } from 'firebase/firestore'; const db = getFirestore(); const likesCol = collection(db, 'posts/post_id_123/likes'); -collectionCount$(likesCol) +collectionCount(likesCol) .pipe( // re-fetch every 30 seconds. // Stop fetching after 100 re-fetches so we don't do too many reads @@ -280,22 +280,22 @@ collectionCount$(likesCol) }); ``` -### `collectionCountSnap$()` +### `collectionCountSnap()` Create an observable that emits the server-calculated number of documents in a collection or query. [Learn more about count queries in the Firebase docs](https://firebase.google.com/docs/firestore/query-data/aggregation-queries). | | | |-----------------|------------------------------------------| -| **function** | `collectionCountSnap$()` | +| **function** | `collectionCountSnap()` | | **params** | query: `import('firebase/firestore').CollectionReference \| import('firebase/firestore').Query`| | **import path** | `rxfire/firestore` or `firebase/firestore/lite` | | **return** | `Observable` | #### TypeScript Example ```ts -import { collectionCountSnap$ } from 'rxfire/firestore'; +import { collectionCountSnap } from 'rxfire/firestore'; // Also available in firestore/lite -import { collectionCountSnap$ } from 'rxfire/firestore/lite'; +import { collectionCountSnap } from 'rxfire/firestore/lite'; import { getFirestore, collection } from 'firebase/firestore'; const db = getFirestore(); diff --git a/test/firestore-lite.test.ts b/test/firestore-lite.test.ts index 51e58b2..c045f09 100644 --- a/test/firestore-lite.test.ts +++ b/test/firestore-lite.test.ts @@ -27,8 +27,8 @@ import { collection, docData, collectionData, - collectionCountSnap$, - collectionCount$, + collectionCountSnap, + collectionCount, } from '../dist/firestore/lite'; import {map} from 'rxjs/operators'; import {default as TEST_PROJECT, firestoreEmulatorPort} from './config'; @@ -235,7 +235,7 @@ describe('RxFire firestore/lite', () => { ]; await Promise.all(entries); - collectionCountSnap$(colRef).subscribe((snap) => { + collectionCountSnap(colRef).subscribe((snap) => { expect(snap.data().count).toEqual(entries.length); done(); }); @@ -252,7 +252,7 @@ describe('RxFire firestore/lite', () => { ]; await Promise.all(entries); - collectionCount$(colRef).subscribe((count) => { + collectionCount(colRef).subscribe((count) => { expect(count).toEqual(entries.length); done(); }); diff --git a/test/firestore.test.ts b/test/firestore.test.ts index d9ef834..e49f80b 100644 --- a/test/firestore.test.ts +++ b/test/firestore.test.ts @@ -30,8 +30,8 @@ import { auditTrail, docData, collectionData, - collectionCountSnap$, - collectionCount$, + collectionCountSnap, + collectionCount, } from '../dist/firestore'; import {map, take, skip} from 'rxjs/operators'; import {default as TEST_PROJECT, firestoreEmulatorPort} from './config'; @@ -434,7 +434,7 @@ describe('RxFire Firestore', () => { ]; await Promise.all(entries); - collectionCountSnap$(colRef).subscribe((snap) => { + collectionCountSnap(colRef).subscribe((snap) => { expect(snap.data().count).toEqual(entries.length); done(); }); @@ -451,7 +451,7 @@ describe('RxFire Firestore', () => { ]; await Promise.all(entries); - collectionCount$(colRef).subscribe((count) => { + collectionCount(colRef).subscribe((count) => { expect(count).toEqual(entries.length); done(); });