[SERVER-52894] Why is the change stream feature supported only on replica sets? Created: 16/Nov/20 Updated: 18/Nov/20 Resolved: 18/Nov/20 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Aggregation Framework, Replication |
| Affects Version/s: | 4.4.0 |
| Fix Version/s: | None |
| Type: | Question | Priority: | Minor - P4 |
| Reporter: | Ivan Rubinson | Assignee: | Edwin Zhou |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Participants: |
| Description |
|
As a user (via the NodeJS driver) unfamiliar with Mongo internals, I have tried using the change stream feature but received an error: "The $changeStream stage is only supported on replica sets". Why is this the expected result? Why is replication needed in order to be able to subscribe to changes to a collection and/or it's document(s)? |
| Comments |
| Comment by Edwin Zhou [ 18/Nov/20 ] |
|
changeStream remedies the complexity and risk caused by tracking the oplog for changes in data. Using changeStream requires a replica set because it depends on an oplog, which standalone mongod instances don't have. As a workaround, you can convert the instance to a single node replica set, which would generate an oplog and attempt to use changeStream again. Let me know if this helps. Best, Edwin |