diff --git a/installation/database-setup.mdx b/installation/database-setup.mdx index 9220dcab..83dfc1e1 100644 --- a/installation/database-setup.mdx +++ b/installation/database-setup.mdx @@ -338,7 +338,7 @@ readWrite@._powersync_checkpoints read@ ``` -To allow PowerSync to automatically configure enable [`changeStreamPreAndPostImages`](#post-images) on +To allow PowerSync to automatically enable [`changeStreamPreAndPostImages`](#post-images) on replicated collections, instead use: ``` @@ -365,22 +365,25 @@ This requires the `changeStreamPreAndPostImages` option to be enabled on replica PowerSync supports three configuration options for post-images: -* `post_images: off`: Uses `fullDocument: 'updateLookup'` for backwards compatibility. This was the default for older instances. However, this may lead to consistency issues, so we strongly recommend enabling post-images support instead. +1. `post_images: off`: Uses `fullDocument: 'updateLookup'` for backwards compatibility. This was the default for older instances. However, this may lead to consistency issues, so we strongly recommend enabling post-images instead. -* `post_images: auto_configure` \[Default for new instances]: Automatically configures the `changeStreamPreAndPostImages` option on collections as needed. +2. `post_images: auto_configure` (Default for new instances): Automatically enables the `changeStreamPreAndPostImages` option on collections as needed. -* `post_images: read_only`: Uses `fullDocument: 'required'` and requires `changeStreamPreAndPostImages: { enabled: true }` to be set on every collection referenced in sync rules. Replication will error if this is not configured. Ideal when permissions are restricted.```js +3. `post_images: read_only`: Uses `fullDocument: 'required'` and requires `changeStreamPreAndPostImages: { enabled: true }` to be set on every collection referenced in Sync Rules. Replication will error if this is not configured. This option is ideal when permissions are restricted. + - To manually configure collections for `read_only` mode, run this on each collection: + ```js db.runCommand( { collMod: , changeStreamPreAndPostImages: { enabled: } } ) - ``````js + ``` + + - You can view which collections have the option enabled using: + ```js db.getCollectionInfos().filter(c => c.options?.changeStreamPreAndPostImages?.enabled) ``` - * You can view which collections have the option enabled using: - - - To manually configure collections for `read_only` mode, run this on each collection: +Post-images can be configured for PowerSync Cloud instances under the connection settings in the Dashboard (right-click on your instance to edit it). For self-hosted PowerSync instances, configure post-images in the config.yaml file; see an example [here](https://github.com/powersync-ja/self-host-demo/blob/main/demos/nodejs-mongodb/config/powersync.yaml). ## MySQL (Alpha)