-
Type:
Bug
-
Resolution: Fixed
-
Priority:
Major - P3
-
Affects Version/s: None
-
Component/s: None
-
None
-
(copied to CRM)
-
None
-
None
-
None
-
None
-
None
-
None
-
None
CSHARP-2746 added the AggregateToCollection methods that would "remove any assumptions about the contents of a $out (or $merge) stage", in order to support an aggregation that outputs to a S3 bucket.
CSHARP-3024 appears to have then added a requirement that if an $out stage has a BsonDocument as an argument it must contain the db and coll parameters, which goes against CSHARP-2746 and prevents running an aggregation with an $out stage to a S3 bucket.
Attempting to run one will produce the following error:
Error is: Element 'db' not found. Stack trace: at MongoDB.Bson.BsonDocument.get_Item(String name) at MongoDB.Driver.Core.Operations.AggregateToCollectionOperation.SimplifyOutStageIfOutputDatabaseIsSameAsInputDatabase(IReadOnlyList`1 pipeline) at MongoDB.Driver.Core.Operations.AggregateToCollectionOperation..ctor(DatabaseNamespace databaseNamespace, IEnumerable`1 pipeline, MessageEncoderSettings messageEncoderSettings) at MongoDB.Driver.Core.Operations.AggregateToCollectionOperation..ctor(CollectionNamespace collectionNamespace, IEnumerable`1 pipeline, MessageEncoderSettings messageEncoderSettings) at MongoDB.Driver.MongoCollectionImpl`1.CreateAggregateToCollectionOperation[TResult](RenderedPipelineDefinition`1 renderedPipeline, AggregateOptions options) at MongoDB.Driver.MongoCollectionImpl`1.Aggregate[TResult](IClientSessionHandle session, PipelineDefinition`2 pipeline, AggregateOptions options, CancellationToken cancellationToken) at MongoDB.Driver.MongoCollectionImpl`1.<>c__DisplayClass19_0`1.<Aggregate>b__0(IClientSessionHandle session) at MongoDB.Driver.MongoCollectionImpl`1.UsingImplicitSession[TResult](Func`2 func, CancellationToken cancellationToken) at MongoDB.Driver.MongoCollectionImpl`1.Aggregate[TResult](PipelineDefinition`2 pipeline, AggregateOptions options, CancellationToken cancellationToken)
It seems that SimplifyOutStageIfOutputDatabaseIsSameAsInputDatabase should only do work if the $out stage is a BsonDocument that contains both db and coll.