skip to Main Content

MongoDB: How to stop and resume change stream

How to stop a mongodb changestream temporarily and resume it again? public Flux<Example> watch() { final ChangeStreamOptions changeStreamOptions = ChangeStreamOptions.builder().returnFullDocumentOnUpdate().build(); return reactiveMongoTemplate.changeStream("collection", changeStreamOptions, Example.class) .filter(e -> e.getOperationType() != null) .mapNotNull(ChangeStreamEvent::getBody); } I'm trying to create a rest endpoint that should…

VIEW QUESTION

MongoDB: Difference between resumeAt and resumeToken in change streams

What is the difference b/w the behavior of resumeAt that accepts a timestamp to resume the notifications from vs resumeToken that accepts the resume token? return ChangeStreamOptions.builder() .filter(Aggregation.newAggregation(Example.class, matchOperationType)) .resumeAt(Instant.ofEpochSecond(1675303335)) // this is simply a unix timestamp .resumeToken(tokenDoc) // resume…

VIEW QUESTION

MongoDB Change Stream: How to keep it alive?

I've been trying to implement a change stream that monitors a Mongo collection for new documents. While simple to setup for catching one change, I don't understand how to keep the process running indefinitely. db = pymongo_util.get_collection("DataDB","XYZ_Collection") stream = db.watch(full_document="updateLookup"):…

VIEW QUESTION
Back To Top
Search