Skip to content

docs(database): fix objectVal/listVal docs and multiple instances example - #3857

Merged
armando-navarro merged 3 commits into
angular:mainfrom
AdamBoczula:docs/fix-database-docs
Dec 3, 2026
Merged

armando-navarro merged 3 commits into
angular:mainfrom
AdamBoczula:docs/fix-database-docs

Conversation

@AdamBoczula

Copy link
Copy Markdown
Contributor

Checklist

  • Issue number for this PR: none
  • Docs included?: yes (docs only)
  • Test units included?: no (docs only)
  • Breaking change?: no
  • In a clean directory, yarn install, yarn test run successfully? not run (Markdown only)

Description

Fixes several inaccuracies in docs/database.md:

  • Swapped objectVal() and listVal() descriptions: objectVal() emits the value of a single node (Observable<T>), while listVal() emits an array of child values (Observable<T[]>). Also fixes listVal()'s parameter name (ref -> query) and return type (Observable<T | null> -> Observable<T[]>).
  • Modular SDK types: replaces the v8 Reference type with DatabaseReference in the convenience observable tables (object, objectVal, list, listVal, stateChanges, auditTrail, fromRef), and aligns the Markdown tables.
  • Typo: fixes options:? -> options?: in the stateChanges table.
  • Multiple instances example: updates provideDatabase((app: FirebaseApp) => getDatabase(app, ...)) to provideDatabase(() => getDatabase(inject(FirebaseApp), ...)), since provideDatabase takes (injector: Injector) => FirebaseDatabase rather than FirebaseApp.

Verification

Checked directly against the source signatures:

  • src/database/database.module.ts: provideDatabase(fn: (injector: Injector) => FirebaseDatabase, ...deps: any[])
  • src/database/firebase.ts / firebase/database: DatabaseReference extends Query
  • rxfire (database/object/index.ts and database/list/index.ts): objectVal<T>(query: Query, options?: { keyField?: string }): Observable<T> and listVal<T>(query: Query, options?: { keyField?: string }): Observable<T[]>

…mple

- Swap the reversed descriptions of objectVal() and listVal(), and fix listVal() return type (Observable<T[]>) and parameter name (query)
- Update Reference to DatabaseReference in the convenience observable tables
- Fix options:? typo in the stateChanges table
- Use inject(FirebaseApp) in provideDatabase() in the Working with multiple instances example
@armando-navarro armando-navarro added comp: database Realtime Database (src/database). comp: docs Documentation. type: chore Maintenance with no user-facing behavior change. labels Dec 3, 2026
@armando-navarro armando-navarro added this to the 22.0.0 milestone Dec 3, 2026

@armando-navarro armando-navarro left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @AdamBoczula, thanks for this. The provideDatabase calls in the multiple instances example on main are a type error, so I'm glad to see them fixed. Approving.

Optional, on the same page

  • The list, stateChanges and auditTrail tables still call the first parameter ref. The functions call it query, as your object and listVal tables now do.
  • The stateChanges description says events filters which child events "populate the array". stateChanges emits one QueryChange at a time, so "which child events are emitted" would be accurate.

Let me know if you'd rather leave these, and I'll merge it as it is.

@armando-navarro armando-navarro added the backport: 21.1.x Cherry-pick onto the 21.1.x branch for a 21.1 minor release label Dec 3, 2026
@AdamBoczula

AdamBoczula commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor Author

Thanks for the review @armando-navarro!
I've just updated PR with your suggestions!

@armando-navarro
armando-navarro merged commit 1256182 into angular:main Dec 3, 2026
25 checks passed
armando-navarro added a commit to armando-navarro/angularfire that referenced this pull request Dec 3, 2026
…mple (angular#3857)

* docs(database): fix objectVal/listVal docs and multiple instances example

- Swap the reversed descriptions of objectVal() and listVal(), and fix listVal() return type (Observable<T[]>) and parameter name (query)
- Update Reference to DatabaseReference in the convenience observable tables
- Fix options:? typo in the stateChanges table
- Use inject(FirebaseApp) in provideDatabase() in the Working with multiple instances example

* docs(database): use query param in list tables and clarify stateChanges

---------

Co-authored-by: Armando Navarro <adnavarro@google.com>
(cherry picked from commit 1256182)
@AdamBoczula
AdamBoczula deleted the docs/fix-database-docs branch December 3, 2026 19:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport: 21.1.x Cherry-pick onto the 21.1.x branch for a 21.1 minor release comp: database Realtime Database (src/database). comp: docs Documentation. type: chore Maintenance with no user-facing behavior change.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants