Exemplo n.º 1
0
        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);
                }
            }
        }
Exemplo n.º 2
0
 public bool MoveNext(CancellationToken cancellationToken = default)
 {
     return(_cursor.MoveNext(cancellationToken));
 }