Пример #1
0
        private static EventFilter CreateFilter(string?streamFilter, StreamPosition streamPosition)
        {
            var byPosition = FilterExtensions.ByPosition(streamPosition);
            var byStream   = FilterExtensions.ByStream(streamFilter);

            if (byStream != null)
            {
                return(Filter.And(byPosition, byStream));
            }

            return(byPosition);
        }
Пример #2
0
        private static PipelineDefinition <ChangeStreamDocument <MongoEventCommit>, ChangeStreamDocument <MongoEventCommit> >?Match(string?streamFilter)
        {
            var result = new EmptyPipelineDefinition <ChangeStreamDocument <MongoEventCommit> >();

            var byStream = FilterExtensions.ByChangeInStream(streamFilter);

            if (byStream != null)
            {
                var filterBuilder = Builders <ChangeStreamDocument <MongoEventCommit> > .Filter;

                var filter = filterBuilder.Or(filterBuilder.Ne(x => x.OperationType, ChangeStreamOperationType.Insert), byStream);

                return(result.Match(filter));
            }

            return(result);
        }