[CSHARP-3535] Regression in support for $out to S3 Created: 07/Apr/21  Updated: 28/Oct/23  Resolved: 08/Apr/21

Status: Closed
Project: C# Driver
Component/s: None
Affects Version/s: None
Fix Version/s: 2.12.3

Type: Bug Priority: Major - P3
Reporter: John Murphy Assignee: Robert Stam
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Case:

 Description   

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.



 Comments   
Comment by Githook User [ 08/Apr/21 ]

Author:

{'name': 'rstam', 'email': 'robert@robertstam.org', 'username': 'rstam'}

Message: CSHARP-3535: Regression in support for $out to S3
Branch: v2.12.x
https://github.com/mongodb/mongo-csharp-driver/commit/1fe8deaf5fd923166e97c3c1f4ee074879338826

Comment by Githook User [ 08/Apr/21 ]

Author:

{'name': 'rstam', 'email': 'robert@robertstam.org', 'username': 'rstam'}

Message: CSHARP-3535: Regression in support for $out to S3
Branch: master
https://github.com/mongodb/mongo-csharp-driver/commit/bb5b38d7407b37453ce1aac82e8a67f5526b2f86

Generated at Wed Feb 07 21:45:34 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.