Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MongoDB Alpha Support #85

Draft
wants to merge 37 commits into
base: feat/modular-replication-architecture
Choose a base branch
from

Conversation

rkistner
Copy link
Contributor

@rkistner rkistner commented Sep 19, 2024

Alpha MongoDB replication module. Loosely based on the Postgres module.

Replication is performed using MongoDB change streams, rather than the low-level oplog API, to make sure we get proper documents out instead of the low-level operations. The clusterTime (oplog timestamp) is used in place of postgres LSN.

Replication currently uses the fullDocument: 'updateLookup' option, which means that operations could replicate out of order. This will be fixed in a future release.

Sample config:

# powersync.yaml
replication:
  connections:
    - type: mongodb
      uri: mongodb://127.0.0.1:27017/powersync_demodb
# sync-rules.yaml
bucket_definitions:
  global:
    data:
      - select _id as id, * from lists
      - select _id as id, * from todos

Demo backend: https://github.com/powersync-ja/powersync-nodejs-backend-todolist-demo
Demo app: https://github.com/powersync-ja/self-host-demo/tree/main/demos/nodejs/demo-app (no changes from the Postgres version)

Copy link

changeset-bot bot commented Sep 19, 2024

🦋 Changeset detected

Latest commit: 5050204

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@powersync/service-module-mongodb Minor
@powersync/service-image Minor

Not sure what this means? Click here to learn what changesets are.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants