Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
fab496f
fix: decode URL-encoded credentials in MongoDB connection config
Sleepful Apr 3, 2026
9eaa41f
test: add red tests for Cosmos DB mode
rkistner Aug 7, 2025
1ea804e
feat: implement Cosmos DB workarounds (wallTime, sentinel, stream gua…
Sleepful Apr 2, 2026
d871a66
fix: sentinel checkpoint resolution and setName guard for Cosmos DB
Sleepful Apr 3, 2026
67fd728
refactor: rename forceCosmosDb to mode on createCheckpoint
Sleepful Apr 3, 2026
e62f753
fix: consistent wall-clock LSNs in cosmosDbMode
Sleepful Apr 3, 2026
74798d4
refactor: remove cosmosDbMode test flag, simplify Cosmos DB detection
Sleepful Apr 4, 2026
83be468
fix: detect Cosmos DB on restart, not just initial sync
Sleepful Apr 6, 2026
f79b879
fix: skip .lte() dedup check on Cosmos DB to prevent data loss
Sleepful Apr 6, 2026
04063d1
fix: write checkpoint polling and resume test reliability on Cosmos DB
Sleepful Apr 7, 2026
ef15b7f
refactor: simplify createWriteCheckpoint Cosmos DB HEAD capture
Sleepful Apr 7, 2026
c04541a
fix: startAtOperationTime not set when resumeAfter is null
Sleepful Apr 7, 2026
a357055
fix: increase Cosmos DB test timeouts to eliminate flakes
Sleepful Apr 7, 2026
774f5a7
merge: catch up with main (raw change streams PR #591)
Sleepful Apr 14, 2026
70b9c9c
docs: update COSMOS_DB_TESTING.md known issues
Sleepful Apr 14, 2026
bf4334b
fix: correct misleading comment in getSnapshotLsn()
Sleepful Apr 15, 2026
2b6ab6b
docs: add comment linking Cosmos DB variant test to its standard equi…
Sleepful Apr 16, 2026
2947f95
fix: support documentdb_versions field in Cosmos DB detection
Sleepful Apr 16, 2026
5c5df55
fix: use batch-level postBatchResumeToken on Cosmos DB
Sleepful Apr 16, 2026
72257d2
docs: update COSMOS_DB_TESTING.md with missing test and upstream chan…
Sleepful Apr 16, 2026
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
5 changes: 5 additions & 0 deletions .changeset/bright-clouds-glow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@powersync/service-module-mongodb': minor
---

Add experimental Cosmos DB MongoDB vCore support. Auto-detects Cosmos DB via `hello` command and applies workarounds for missing `clusterTime`, `operationTime`, and unsupported change stream features.
24 changes: 24 additions & 0 deletions modules/module-mongodb/src/api/MongoRouteAPIAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ export class MongoRouteAPIAdapter implements api.RouteAPI {
connectionTag: string;
defaultSchema: string;

private isCosmosDb: boolean | null = null;

constructor(protected config: types.ResolvedConnectionConfig) {
const manager = new MongoManager(config);
this.client = manager.client;
Expand Down Expand Up @@ -206,9 +208,31 @@ export class MongoRouteAPIAdapter implements api.RouteAPI {
return undefined;
}

private async detectCosmosDb(): Promise<boolean> {
if (this.isCosmosDb === null) {
const hello = await this.db.command({ hello: 1 });
this.isCosmosDb = hello.internal?.cosmos_versions != null || hello.internal?.documentdb_versions != null;
}
return this.isCosmosDb;
}

async createReplicationHead<T>(callback: ReplicationHeadCallback<T>): Promise<T> {
const session = this.client.startSession();
try {
if (await this.detectCosmosDb()) {
// Cosmos DB: write sentinel to trigger change stream advance
await this.db
.collection(CHECKPOINTS_COLLECTION)
.findOneAndUpdate(
{ _id: STANDALONE_CHECKPOINT_ID as any },
{ $inc: { i: 1 } },
{ upsert: true, returnDocument: 'after', session }
);
// HEAD is unknown — caller must poll storage to determine it
return await callback(null);
}

// Standard MongoDB: existing path
await this.db.command({ hello: 1 }, { session });
const head = session.clusterTime?.clusterTime;
if (head == null) {
Expand Down
Loading
Loading