[JAVA-4258] Aggregation helper fails on simplified string form for $merge stage Created: 23/Jul/21  Updated: 28/Oct/23  Resolved: 01/Aug/21

Status: Closed
Project: Java Driver
Component/s: Write Operations
Affects Version/s: None
Fix Version/s: 4.3.1, 3.12.10

Type: Bug Priority: Major - P3
Reporter: Christoph Strobl Assignee: Jeffrey Yemin
Resolution: Fixed Votes: 0
Labels: external-user
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Documentation Changes: Not Needed

 Description   

Originally reported in spring-data-mongodb#3743.

In AggregateIterableImpl.getOutNamespace method
BsonDocument mergeDocument = lastStageDocument.getDocument("$merge")
this line does not consider simple String type when $merge use the simplified form, like {$merge: <collection>}

The workaround is to use the long form of $merge, as documented here.



 Comments   
Comment by Githook User [ 29/Jul/21 ]

Author:

{'name': 'Jeff Yemin', 'email': 'jeff.yemin@mongodb.com', 'username': 'jyemin'}

Message: Support aggregation with $merge as a string (#768)

JAVA-4258
Branch: 3.12.x
https://github.com/mongodb/mongo-java-driver/commit/2a32ac3a7c2c277c7406bb83024df0af13b50008

Comment by Githook User [ 29/Jul/21 ]

Author:

{'name': 'Jeff Yemin', 'email': 'jeff.yemin@mongodb.com', 'username': 'jyemin'}

Message: Support aggregation with $merge as a string (#768)

JAVA-4258
Branch: 4.3.x
https://github.com/mongodb/mongo-java-driver/commit/05fdd7e941d42d19de361758d0a012414c5dba32

Comment by Githook User [ 29/Jul/21 ]

Author:

{'name': 'Jeff Yemin', 'email': 'jeff.yemin@mongodb.com', 'username': 'jyemin'}

Message: Support aggregation with $merge as a string (#768)

JAVA-4258
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/7d1eabbd631e62e3da7e71080d7d893066443228

Comment by Jeffrey Yemin [ 23/Jul/21 ]

Thanks for opening this case, cstrobl. I agree it's a bug. We missed the fact that there is a simplified form of $merge.

Generated at Thu Feb 08 09:01:37 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.