spring-data-mongodb icon indicating copy to clipboard operation
spring-data-mongodb copied to clipboard

Make ChangeStreamOptionsBuilder support startAtOperationTime [DATAMONGO-2607]

Open spring-projects-issues opened this issue 5 years ago • 6 comments

Johan Haleby opened DATAMONGO-2607 and commented

Newer versions of the MongoDB java driver (and server) supports "startAtOperationTime" for change streams (https://docs.mongodb.com/manual/changeStreams/) to be able to resume a change stream even after an "invalidate" event. But the ChangeStreamOptionsBuilder currently only allows specifying "resumeAt" and not "startAtOperationTime" which prohibits this use case. In the application I'm developing this is really important but I cannot find a workaround when using Spring Data MongoDB. 

It would be great if this could be supported by Spring Data MongoDB as well


Affects: 3.1 M1 (2020.0.0), 3.0.2 (Neumann SR2)

Reference URL: https://stackoverflow.com/questions/55184492/difference-between-resumeafter-and-startatoperationtime-in-mongodb-change-stream

spring-projects-issues avatar Aug 10 '20 06:08 spring-projects-issues

Anything I can do to help?

johanhaleby avatar Feb 05 '21 06:02 johanhaleby

@johanhaleby If you have some time, a PR would be welcome :)

christophstrobl avatar Feb 05 '21 07:02 christophstrobl

@christophstrobl can I make a PR for it? Asking because nothing happened to it from Feb 2021

tudormarc avatar May 25 '22 19:05 tudormarc

@tudormarc a PR would be welcome :)

christophstrobl avatar May 30 '22 05:05 christophstrobl

@christophstrobl PR submitted :)

tudormarc avatar May 31 '22 13:05 tudormarc

After having a look, we already support setting startAtOperationTime via ChangeStreamOptions.resumeAt(…). Depending on the presence of a resume token, we either set resumeAfter or startAfter. I'm wondering what's missing as we already set all of these options and the pull request #4071 isn't setting any of the mentioned options on the Mongo ChangeStreamIterable or ChangeStreamPublisher.

mp911de avatar Jun 27 '22 14:06 mp911de