Skip to content

Commit 9f0c1d0

Browse files
authored
feat(mongodb): add the MongoDB destination package (#41)
1 parent 05e8fb4 commit 9f0c1d0

48 files changed

Lines changed: 7175 additions & 8 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/ci.yml‎

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,41 @@ jobs:
109109
- name: End-to-end example
110110
run: pnpm --filter workos-sync-postgres-example start
111111

112+
mongodb:
113+
name: MongoDB Node ${{ matrix.node }}
114+
runs-on: ubuntu-latest
115+
strategy:
116+
fail-fast: false
117+
matrix:
118+
node: [22, 24]
119+
steps:
120+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
121+
with:
122+
persist-credentials: false
123+
124+
- uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413 # v6.1.0
125+
126+
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
127+
with:
128+
node-version: ${{ matrix.node }}
129+
130+
# The suite runs on an embedded mongod (mongodb-memory-server), which
131+
# downloads the binary on first use; the cache keeps that off the
132+
# critical path. The version is pinned in the package's package.json.
133+
- uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
134+
with:
135+
path: ~/.cache/mongodb-binaries
136+
key: mongodb-binaries-${{ runner.os }}-${{ hashFiles('packages/sync-mongodb/package.json') }}
137+
138+
- name: Install
139+
run: pnpm install --frozen-lockfile
140+
141+
- name: Test
142+
run: pnpm --filter @workos/sync-mongodb test
143+
144+
- name: Build
145+
run: pnpm --filter "@workos/sync-mongodb..." build
146+
112147
mysql:
113148
name: MySQL Node ${{ matrix.node }}
114149
runs-on: ubuntu-latest

‎.github/workflows/docker.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ jobs:
2222
# One entry per destination package: packages/sync-<destination>.
2323
destination:
2424
- postgres
25+
- mongodb
2526
- mysql
2627
runner: [ubuntu-latest, ubuntu-24.04-arm]
2728
steps:

‎.github/workflows/release-please.yml‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ jobs:
3737
sync-postgres--tag_name: ${{ steps.release.outputs['packages/sync-postgres--tag_name'] }}
3838
sync-mysql--release_created: ${{ steps.release.outputs['packages/sync-mysql--release_created'] }}
3939
sync-mysql--tag_name: ${{ steps.release.outputs['packages/sync-mysql--tag_name'] }}
40+
sync-mongodb--release_created: ${{ steps.release.outputs['packages/sync-mongodb--release_created'] }}
41+
sync-mongodb--tag_name: ${{ steps.release.outputs['packages/sync-mongodb--tag_name'] }}
4042
steps:
4143
# Release PRs and tags come from the SDK Automation Bot, as in workos-node.
4244
# Events raised with GITHUB_TOKEN start no workflow runs, so a release PR
@@ -94,3 +96,15 @@ jobs:
9496
tag_name: ${{ needs.release-please.outputs.sync-mysql--tag_name }}
9597
secrets:
9698
PUBLIC_SOCKET_FIREWALL_TOKEN: ${{ secrets.PUBLIC_SOCKET_FIREWALL_TOKEN }}
99+
100+
publish-sync-mongodb:
101+
needs: [release-please, publish-sync-engine]
102+
if: >-
103+
${{ !cancelled()
104+
&& needs.publish-sync-engine.result != 'failure'
105+
&& needs.release-please.outputs.sync-mongodb--release_created == 'true' }}
106+
uses: ./.github/workflows/release.yml
107+
with:
108+
tag_name: ${{ needs.release-please.outputs.sync-mongodb--tag_name }}
109+
secrets:
110+
PUBLIC_SOCKET_FIREWALL_TOKEN: ${{ secrets.PUBLIC_SOCKET_FIREWALL_TOKEN }}

‎.release-please-manifest.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"packages/sync-engine": "0.1.0",
33
"packages/sync-postgres": "0.1.0",
4+
"packages/sync-mongodb": "0.0.0",
45
"packages/sync-mysql": "0.0.0"
56
}

‎README.md‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,15 @@ base tables keep them as tombstones for when you want to ask who left.
3131
One engine, one package per database. Each ships a CLI with the same
3232
commands and a container image under the same name:
3333

34-
| Destination | Package | Mirror |
35-
| ----------- | ------------------------------------------------- | ---------------------------------------------------------------------- |
36-
| Postgres | [`@workos/sync-postgres`](packages/sync-postgres) | A `workos` schema of tables with generated columns and `_live` views |
37-
| MySQL | [`@workos/sync-mysql`](packages/sync-mysql) | A `workos` database of tables with generated columns and `_live` views |
34+
| Destination | Package | Mirror |
35+
| ----------- | ------------------------------------------------- | ----------------------------------------------------------------------- |
36+
| Postgres | [`@workos/sync-postgres`](packages/sync-postgres) | A `workos` schema of tables with generated columns and `_live` views |
37+
| MongoDB | [`@workos/sync-mongodb`](packages/sync-mongodb) | `workos_*` collections in your database, with indexes and `_live` views |
38+
| MySQL | [`@workos/sync-mysql`](packages/sync-mysql) | A `workos` database of tables with generated columns and `_live` views |
3839

3940
The rest of this page shows Postgres; every command and option below has a
40-
MySQL counterpart, and each package's README is the reference for it.
41+
MongoDB and a MySQL counterpart, and each package's README is the reference
42+
for it.
4143

4244
## Try it in 30 seconds
4345

‎packages/sync-engine/README.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ package and re-exports it, so it is the only thing to install:
1111
| Destination | Package |
1212
| ----------- | ------------------------------------------------------------------------------ |
1313
| Postgres | [`@workos/sync-postgres`](https://www.npmjs.com/package/@workos/sync-postgres) |
14+
| MongoDB | [`@workos/sync-mongodb`](https://www.npmjs.com/package/@workos/sync-mongodb) |
1415
| MySQL | [`@workos/sync-mysql`](https://www.npmjs.com/package/@workos/sync-mysql) |
1516

1617
Install this package directly only to write a new destination.

‎packages/sync-mongodb/LICENSE.txt‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2026 WorkOS
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

0 commit comments

Comments
 (0)