| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
There was a problem hiding this comment.
Thank you! Added some comments
Sorry, something went wrong.
|
|
||
| // @beta | ||
| export function getFirestore(app: App, databaseId: string): Firestore; | ||
|
|
There was a problem hiding this comment.
I think if we combine the two methods the docs will be more readable.
export function getFirestore(app?: App, databaseId: string): Firestore;
Sorry, something went wrong.
Sorry, something went wrong.
There was a problem hiding this comment.
What I meant to say was to keep both as optional parameters so you don't need three method signatures. It also simplifies the docs.
export function getFirestore(app?: App, databaseId?: string): Firestore;
export function getFirestore(
appOrDatabaseId?: App | string,
optionalDatabaseId?: string
): Firestore {
Sorry, something went wrong.
There was a problem hiding this comment.
I still think calling getFirestore(null, 'myDB') is worse than having overload getFirestore('myDB').
TypeScript doesn't expose the last signature, nor would I want to. The signature suggests someone could write code getFirestore('myDB', 'myDB') which isn't allowed.
export function getFirestore( appOrDatabaseId?: App | string, optionalDatabaseId?: string ): Firestore
Sorry, something went wrong.
|
|
||
| // @beta | ||
| export function initializeFirestore(app: App, settings: FirestoreSettings, databaseId: string): Firestore; | ||
|
|
There was a problem hiding this comment.
Would it make more sense to include the databaseId in FirestoreSettings?
Sorry, something went wrong.
There was a problem hiding this comment.
TLDR; No, I I think this is a bad idea.
The admin SDK manages lifecycle of Firestore instances, such that subsequent requests will return the same instance. The app and databaseId form the key to this cache, and should really be held separate from settings in my opinion.
Other methods such as getFirestore, do not take a settings object. Adding a settings object here would conflict with intent to have getFirestore simply be a method to return an existing instance (if one exists).
initializeFirestore cannot be called with different settings, since settings cannot be changed after Firestore instance has been started. The semantic difference that "some" settings such as database id are allowed to change, will simply add confusion to interface. A simple rule that no settings are allowed to change can be maintained by excluding databaseId from settings.
Sorry, something went wrong.
There was a problem hiding this comment.
Makes sense! Thank you
Sorry, something went wrong.
| * Gets the default {@link https://googleapis.dev/nodejs/firestore/latest/Firestore.html | Firestore} | ||
| * service for the default app. | ||
| * | ||
| * `getFirestore()` can be called with no arguments to access the default |
There was a problem hiding this comment.
Please get these documentation changes reviewed by a tech writer before merging the PR. Thanks!
Sorry, something went wrong.
There was a problem hiding this comment.
Sorry, something went wrong.
There was a problem hiding this comment.
Thanks Mark!
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
RELEASE NOTE: Added support for multiple named databases. This feature is currently in public preview.