matthieucham commented on pull request #7293:
URL: https://github.com/apache/beam/pull/7293#issuecomment-763758511


   Hey guys, sorry to bother you, I don't know if it's the right place but I 
have some issues with what as been commited in this PR: It seems to me that 
multiple stages AggregationQuery pipelines are not correctly handled, because 
of this method:
   
   ```java
   public MongoCursor<Document> apply(@UnknownKeyFor @NonNull @Initialized 
MongoCollection<Document> collection) {
           if (this.bucket() != null) {
               if (this.mongoDbPipeline().size() == 1) {
                   this.mongoDbPipeline().add(this.bucket());
               } else {
                   this.mongoDbPipeline().set(this.mongoDbPipeline().size() - 
1, this.bucket());
               }
           }
   
           return collection.aggregate(this.mongoDbPipeline()).iterator();
       }
   ```
   
   The .set(...) looks very odd to me as it replaces the last stage of the 
pipeline, I don't get how that could be correct ? (Note that I'm new to MongoDB 
so maybe that explains...)
   
   Moreover, I wanted to test and override this by providing my own QueryFn, 
but it appears in MongoDBIO implementation that this function will be 
force-casted to either FilterQuery or AggregationQuery. Shouldn't we be able to 
provide any function as long as the contract is respected ?
   
   Hopefully, you're still reading this thread. Please point me to the right 
place if I should post this comment elsewhere
   
   Thanks


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to