internal void StartChangeStream(IMongoCollection <CompanyDto> targets) { // IChangeStreamCursor<ChangeStreamDocument<CompanyDto>> cursor = targets.Watch(pipeline, options); cursor = targets.Watch(); ChangeStreamDocument <CompanyDto> nextDoc; while (true) { // if there is a new batch of documents in the cursor if (!(cursor.MoveNext() && cursor.Current.Count() == 0)) { nextDoc = cursor.Current.First(); MessageEncountered(nextDoc); } } }
public bool MoveNext(CancellationToken cancellationToken = default) { return(_cursor.MoveNext(cancellationToken)); }