tulip / oplogtoredis

Publish MongoDB oplog entries to Redis
Apache License 2.0
38 stars 9 forks source link

Ensure correct handling of all possible oplog messages, especially array mutations #10

Closed benweissmann closed 6 years ago

benweissmann commented 6 years ago

We currently use a very simple algorithm to derive the modified fields from an oplog record (https://github.com/tulip/oplogtoredis/blob/85ebc4bca6b50f572160cdba078c910ebdd89c0b/main.go#L149).

redis-oplog has somewhat more complicated logic (https://github.com/cult-of-coders/redis-oplog/blob/209334ac7687432da54b335e16cb4c56aff6212b/lib/utils/getFields.js#L7), but we might not need to duplicate that because the oplog simplifies many mutations to make them idempotent.

We should test what happens when submitting complicated mutations that use more-complicated operators that e.g. $set, arrays nested deeply within objects, etc., and make sure that oplogtoredis correctly publishes record that are compatible with redis-oplog.

benweissmann commented 6 years ago

Tested weird array updates (see: 6f0b97f29ea643b0ef86c97ff3d7c7166204d89a). Appears to work correctly.