Skip to content

Commit 7cb1a75

Browse files
authored
Merge 8b0a1a1 into 8283a55
2 parents 8283a55 + 8b0a1a1 commit 7cb1a75

File tree

4 files changed

+29
-24
lines changed

4 files changed

+29
-24
lines changed

.changeset/quick-otters-applaud.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@firebase/firestore': patch
3+
---
4+
5+
Clarify method documentation.

common/api-review/firestore.api.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -299,15 +299,15 @@ export function getDocsFromCache<AppModelType, DbModelType extends DocumentData>
299299
// @public
300300
export function getDocsFromServer<AppModelType, DbModelType extends DocumentData>(query: Query<AppModelType, DbModelType>): Promise<QuerySnapshot<AppModelType, DbModelType>>;
301301

302+
// @public
303+
export function getFirestore(): Firestore;
304+
302305
// @public
303306
export function getFirestore(app: FirebaseApp): Firestore;
304307

305308
// @beta
306309
export function getFirestore(databaseId: string): Firestore;
307310

308-
// @public
309-
export function getFirestore(): Firestore;
310-
311311
// @beta
312312
export function getFirestore(app: FirebaseApp, databaseId: string): Firestore;
313313

docs-devsite/firestore_.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ https://github.com/firebase/firebase-js-sdk
1717
| --- | --- |
1818
| <b>function(app...)</b> |
1919
| [getFirestore(app)](./firestore_.md#getfirestore) | Returns the existing default [Firestore](./firestore_.firestore.md#firestore_class) instance that is associated with the provided [FirebaseApp](./app.firebaseapp.md#firebaseapp_interface)<!-- -->. If no instance exists, initializes a new instance with default settings. |
20-
| [getFirestore(app, databaseId)](./firestore_.md#getfirestore) | <b><i>(BETA)</i></b> Returns the existing default [Firestore](./firestore_.firestore.md#firestore_class) instance that is associated with the provided [FirebaseApp](./app.firebaseapp.md#firebaseapp_interface)<!-- -->. If no instance exists, initializes a new instance with default settings. |
20+
| [getFirestore(app, databaseId)](./firestore_.md#getfirestore) | <b><i>(BETA)</i></b> Returns the existing named [Firestore](./firestore_.firestore.md#firestore_class) instance that is associated with the provided [FirebaseApp](./app.firebaseapp.md#firebaseapp_interface)<!-- -->. If no instance exists, initializes a new instance with default settings. |
2121
| [initializeFirestore(app, settings, databaseId)](./firestore_.md#initializefirestore) | Initializes a new instance of [Firestore](./firestore_.firestore.md#firestore_class) with the provided settings. Can only be called before any other function, including [getFirestore()](./firestore_.md#getfirestore)<!-- -->. If the custom settings are empty, this function is equivalent to calling [getFirestore()](./firestore_.md#getfirestore)<!-- -->. |
2222
| <b>function(firestore...)</b> |
2323
| [clearIndexedDbPersistence(firestore)](./firestore_.md#clearindexeddbpersistence) | Clears the persistent storage. This includes pending writes and cached documents.<!-- -->Must be called while the [Firestore](./firestore_.firestore.md#firestore_class) instance is not started (after the app is terminated or when the app is first initialized). On startup, this function must be called before other functions (other than [initializeFirestore()](./firestore_.md#initializefirestore) or [getFirestore()](./firestore_.md#getfirestore)<!-- -->)). If the [Firestore](./firestore_.firestore.md#firestore_class) instance is still running, the promise will be rejected with the error code of <code>failed-precondition</code>.<!-- -->Note: <code>clearIndexedDbPersistence()</code> is primarily intended to help write reliable tests that use Cloud Firestore. It uses an efficient mechanism for dropping existing data but does not attempt to securely overwrite or otherwise make cached data unrecoverable. For applications that are sensitive to the disclosure of cached data in between user sessions, we strongly recommend not enabling persistence at all. |
@@ -49,7 +49,7 @@ https://github.com/firebase/firebase-js-sdk
4949
| [persistentMultipleTabManager()](./firestore_.md#persistentmultipletabmanager) | Creates an instance of <code>PersistentMultipleTabManager</code>. |
5050
| [serverTimestamp()](./firestore_.md#servertimestamp) | Returns a sentinel used with [setDoc()](./firestore_lite.md#setdoc) or [updateDoc()](./firestore_lite.md#updatedoc) to include a server-generated timestamp in the written data. |
5151
| <b>function(databaseId...)</b> |
52-
| [getFirestore(databaseId)](./firestore_.md#getfirestore) | <b><i>(BETA)</i></b> Returns the existing [Firestore](./firestore_.firestore.md#firestore_class) instance that is associated with the default [FirebaseApp](./app.firebaseapp.md#firebaseapp_interface)<!-- -->. If no instance exists, initializes a new instance with default settings. |
52+
| [getFirestore(databaseId)](./firestore_.md#getfirestore) | <b><i>(BETA)</i></b> Returns the existing named [Firestore](./firestore_.firestore.md#firestore_class) instance that is associated with the default [FirebaseApp](./app.firebaseapp.md#firebaseapp_interface)<!-- -->. If no instance exists, initializes a new instance with default settings. |
5353
| <b>function(elements...)</b> |
5454
| [arrayRemove(elements)](./firestore_.md#arrayremove) | Returns a special value that can be used with [setDoc()](./firestore_.md#setdoc) or that tells the server to remove the given elements from any array value that already exists on the server. All instances of each element specified will be removed from the array. If the field being modified is not already an array it will be overwritten with an empty array. |
5555
| [arrayUnion(elements)](./firestore_.md#arrayunion) | Returns a special value that can be used with [setDoc()](./firestore_lite.md#setdoc) or [updateDoc()](./firestore_lite.md#updatedoc) that tells the server to union the given elements with any array value that already exists on the server. Each specified element that doesn't already exist in the array will be added to the end. If the field being modified is not already an array it will be overwritten with an array containing exactly the specified elements. |
@@ -240,14 +240,14 @@ export declare function getFirestore(app: FirebaseApp): Firestore;
240240

241241
[Firestore](./firestore_.firestore.md#firestore_class)
242242

243-
The [Firestore](./firestore_.firestore.md#firestore_class) instance of the provided app.
243+
The default [Firestore](./firestore_.firestore.md#firestore_class) instance of the provided app.
244244

245245
## getFirestore()
246246

247247
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
248248
>
249249
250-
Returns the existing default [Firestore](./firestore_.firestore.md#firestore_class) instance that is associated with the provided [FirebaseApp](./app.firebaseapp.md#firebaseapp_interface)<!-- -->. If no instance exists, initializes a new instance with default settings.
250+
Returns the existing named [Firestore](./firestore_.firestore.md#firestore_class) instance that is associated with the provided [FirebaseApp](./app.firebaseapp.md#firebaseapp_interface)<!-- -->. If no instance exists, initializes a new instance with default settings.
251251

252252
<b>Signature:</b>
253253

@@ -266,7 +266,7 @@ export declare function getFirestore(app: FirebaseApp, databaseId: string): Fire
266266

267267
[Firestore](./firestore_.firestore.md#firestore_class)
268268

269-
The [Firestore](./firestore_.firestore.md#firestore_class) instance of the provided app.
269+
The named [Firestore](./firestore_.firestore.md#firestore_class) instance of the provided app.
270270

271271
## initializeFirestore()
272272

@@ -901,7 +901,7 @@ export declare function getFirestore(): Firestore;
901901

902902
[Firestore](./firestore_.firestore.md#firestore_class)
903903

904-
The [Firestore](./firestore_.firestore.md#firestore_class) instance of the provided app.
904+
The default [Firestore](./firestore_.firestore.md#firestore_class) instance of the default app.
905905

906906
## memoryEagerGarbageCollector()
907907

@@ -947,7 +947,7 @@ export declare function serverTimestamp(): FieldValue;
947947
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
948948
>
949949
950-
Returns the existing [Firestore](./firestore_.firestore.md#firestore_class) instance that is associated with the default [FirebaseApp](./app.firebaseapp.md#firebaseapp_interface)<!-- -->. If no instance exists, initializes a new instance with default settings.
950+
Returns the existing named [Firestore](./firestore_.firestore.md#firestore_class) instance that is associated with the default [FirebaseApp](./app.firebaseapp.md#firebaseapp_interface)<!-- -->. If no instance exists, initializes a new instance with default settings.
951951

952952
<b>Signature:</b>
953953

@@ -965,7 +965,7 @@ export declare function getFirestore(databaseId: string): Firestore;
965965

966966
[Firestore](./firestore_.firestore.md#firestore_class)
967967

968-
The [Firestore](./firestore_.firestore.md#firestore_class) instance of the provided app.
968+
The named [Firestore](./firestore_.firestore.md#firestore_class) instance of the default app.
969969

970970
## arrayRemove()
971971

packages/firestore/src/api/database.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -195,43 +195,43 @@ export function initializeFirestore(
195195
});
196196
}
197197

198+
/**
199+
* Returns the existing default {@link Firestore} instance that is associated with the
200+
* default {@link @firebase/app#FirebaseApp}. If no instance exists, initializes a new
201+
* instance with default settings.
202+
*
203+
* @returns The default {@link Firestore} instance of the default app.
204+
*/
205+
export function getFirestore(): Firestore;
198206
/**
199207
* Returns the existing default {@link Firestore} instance that is associated with the
200208
* provided {@link @firebase/app#FirebaseApp}. If no instance exists, initializes a new
201209
* instance with default settings.
202210
*
203211
* @param app - The {@link @firebase/app#FirebaseApp} instance that the returned {@link Firestore}
204212
* instance is associated with.
205-
* @returns The {@link Firestore} instance of the provided app.
213+
* @returns The default {@link Firestore} instance of the provided app.
206214
*/
207215
export function getFirestore(app: FirebaseApp): Firestore;
208216
/**
209-
* Returns the existing {@link Firestore} instance that is associated with the
217+
* Returns the existing named {@link Firestore} instance that is associated with the
210218
* default {@link @firebase/app#FirebaseApp}. If no instance exists, initializes a new
211219
* instance with default settings.
212220
*
213221
* @param databaseId - The name of the database.
214-
* @returns The {@link Firestore} instance of the provided app.
222+
* @returns The named {@link Firestore} instance of the default app.
215223
* @beta
216224
*/
217225
export function getFirestore(databaseId: string): Firestore;
218226
/**
219-
* Returns the existing default {@link Firestore} instance that is associated with the
220-
* default {@link @firebase/app#FirebaseApp}. If no instance exists, initializes a new
221-
* instance with default settings.
222-
*
223-
* @returns The {@link Firestore} instance of the provided app.
224-
*/
225-
export function getFirestore(): Firestore;
226-
/**
227-
* Returns the existing default {@link Firestore} instance that is associated with the
227+
* Returns the existing named {@link Firestore} instance that is associated with the
228228
* provided {@link @firebase/app#FirebaseApp}. If no instance exists, initializes a new
229229
* instance with default settings.
230230
*
231231
* @param app - The {@link @firebase/app#FirebaseApp} instance that the returned {@link Firestore}
232232
* instance is associated with.
233233
* @param databaseId - The name of the database.
234-
* @returns The {@link Firestore} instance of the provided app.
234+
* @returns The named {@link Firestore} instance of the provided app.
235235
* @beta
236236
*/
237237
export function getFirestore(app: FirebaseApp, databaseId: string): Firestore;

0 commit comments

Comments
 (0)