Skip to content

Incremental sync pattern is invalid for eventually consistent cluster #157

Description

@basilevs

## Incremental Sync Pattern
A common pattern for syncing data to another system:
```javascript
async function syncChanges(lastSyncTime) {
const cursor = db.collection("products").find(
{ updatedAt: { $gt: lastSyncTime } },
{ sort: { updatedAt: 1 } }
);
const changes = await cursor.toArray();
// process changes...
const newSyncTime = changes.length > 0
? changes[changes.length - 1].updatedAt
: lastSyncTime;
return newSyncTime;
}
```

This will not work correclty even with Read concern: "linearizable".

What are compatible read and write concerns?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions