Esempio n. 1
0
 // public methods
 public override void ToCollection(CancellationToken cancellationToken)
 {
     if (_session == null)
     {
         _database.AggregateToCollection(_pipeline, _options, cancellationToken);
     }
     else
     {
         _database.AggregateToCollection(_session, _pipeline, _options, cancellationToken);
     }
 }
Esempio n. 2
0
        public void AggregateToCollection <TResult>(
            PipelineDefinition <NoPipelineInput, TResult> pipeline,
            AggregateOptions?options            = null,
            CancellationToken cancellationToken = default)
        {
            if (TryGetSession(out IClientSessionHandle? session))
            {
                _database.AggregateToCollection(session, pipeline, options, cancellationToken);
                return;
            }

            _database.AggregateToCollection(pipeline, options, cancellationToken);
        }