powersync-ja / powersync-service

Other
123 stars 9 forks source link

MongoDB postImages #121

Open rkistner opened 21 hours ago

rkistner commented 21 hours ago

This adds an option to use MongoDB postImages when replicating changes, to get proper consistency of updates.

For what this means, see: https://www.mongodb.com/docs/v6.0/reference/command/collMod/#change-streams-with-document-pre--and-post-images

Since this can be a breaking change for existing instances, it is not automatically enabled.

There are three valid options:

  1. post_images: off: The current behavior and the default to prevent breaking existing instances. This may produce updates out of order.
  2. post_images: read_only: This requires changeStreamPreAndPostImages: { enabled: true } to be set on every collection that is referenced in sync rules, otherwise replication will error. Ideal when permissions are restricted.
  3. post_images: auto_configure: This automatically configures the changeStreamPreAndPostImages option on collections if needed. Requires the collMod permission.

TODO:

changeset-bot[bot] commented 21 hours ago

⚠️ No Changeset found

Latest commit: 0206aaab0264362a4cff4c514b510836ade107b9

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR