You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/collections/rxdb-collection.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,7 +20,7 @@ The `@tanstack/rxdb-db-collection` package allows you to create collections that
20
20
- Leverage RxDB's [replication plugins](https://rxdb.info/replication.html) to sync with CouchDB, MongoDB, Supabase, REST APIs, GraphQL, WebRTC (P2P) and more.
21
21
22
22
23
-
## 1. Installation
23
+
###1. Installation
24
24
25
25
Install the RxDB collection packages along with your preferred framework integration.
@@ -93,7 +93,7 @@ import { rxdbCollectionOptions } from '@tanstack/rxdb-db-collection'
93
93
94
94
const todosCollection =createCollection(
95
95
rxdbCollectionOptions({
96
-
rxCollection: myDatabase.todos,
96
+
rxCollection: db.todos,
97
97
startSync: true, // start ingesting RxDB data immediately
98
98
})
99
99
)
@@ -118,7 +118,7 @@ The `rxdbCollectionOptions` function accepts the following options:
118
118
### Optional
119
119
120
120
-`id`: Unique identifier for the collection
121
-
-`schema`: Schema for validating items. RxDB already has schema validation but having additional validation on the TanStack DB side can help to unify error handling between different tanstack collections.
121
+
-`schema`: Schema for validating items. RxDB already has schema validation but having additional validation on the TanStack DB side can help to unify error handling between different TanStack collections.
122
122
-`startSync`: Whether to start syncing immediately (default: true)
123
123
-`onInsert, onUpdate, onDelete`: Override default persistence handlers. By default, TanStack DB writes are persisted to RxDB using bulkUpsert, patch, and bulkRemove.
124
124
-`syncBatchSize`: The maximum number of documents fetched per batch during the initial sync from RxDB into TanStack DB (default: 1000). Larger values reduce round trips but use more memory; smaller values are lighter but may increase query calls. Note that this only affects the initial sync. Ongoing live updates are streamed one by one via RxDB's change feed.
@@ -138,7 +138,7 @@ This separation of concerns means you configure replication entirely in RxDB, an
138
138
139
139
### Do I still need RxDB schema indexes if I only query TanStack DB?
140
140
141
-
Usually not for TanStack DB queries themselves. TanStack DB queries run entirely in memory, so RxDB schema indexes do not affect the performance of TanStack DB's live queries. However, RxDB indexes may still be important if:
141
+
Usually not, at least for TanStack DB queries themselves. TanStack DB queries run entirely in memory, so RxDB schema indexes do not affect the performance of TanStack DB's live queries. However, RxDB indexes may still be important if:
142
142
- You run queries directly against RxDB (e.g. `rxCollection.find(...)`).
143
143
- Your replication setup uses filtered queries or selectors.
144
144
- You rely on RxDB to selectively load subsets of data instead of hydrating everything into memory.
0 commit comments