Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions installation/database-setup.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ readWrite@<your_database>._powersync_checkpoints
read@<your_database>
```

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:

```
Expand All @@ -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.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Ralf mentioned we want to discontinue this setting in the future, so might be worth mentioning that this will be discontinued at some point


* `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: <collection>,
changeStreamPreAndPostImages: { enabled: <boolean> }
} )
``````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).

## <Icon icon="dolphin" iconType="solid" size="24" /> MySQL (Alpha)

Expand Down
Loading