[COMPASS-3600] Aggregation to Java -> Group -> eq instead of DBObject Created: 27/Apr/19 Updated: 15/May/19 Resolved: 15/May/19 |
|
| Status: | Closed |
| Project: | Compass |
| Component/s: | Aggregation pipeline, Export to Language |
| Affects Version/s: | 1.17.0 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Minor - P4 |
| Reporter: | Andre Powroznik | Assignee: | Unassigned |
| Resolution: | Cannot Reproduce | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Attachments: |
|
| Description |
|
Hello, I convert an aggregation that works in Compass to Java, and it throws an exception. I have to make some very small changes to the group part to make it work (in Java, replace eq with new BasicDBObject). Is this a bug? This aggregation, in MongoDB Compass 1.17.0: , 3600000 ] , , , } Arrays.asList(match(and(eq("source", "Kraken"), eq("currencyFrom", "XXBT"), eq("currencyTo", "ZEUR"))), group(eq("$toDate", eq("$multiply", Arrays.asList(eq("$floor", eq("$divide", Arrays.asList(eq("$toLong", "$date"), 3600000L))), 3600000L))), sum("ct", 1L), min("min", "$value"), avg("avg", "$value"), max("max", "$value"))) Which results in this exception: Exception in thread "main" org.bson.codecs.configuration.CodecConfigurationException: Can't find a codec for class com.mongodb.client.model.Filters$SimpleEncodingFilter. In order to fix it, in the group part, I had to replace "eq" with "new BasicDBObject". Is this a bug in Compass? Kind regards, |
| Comments |
| Comment by Massimiliano Marcon [ 09/May/19 ] | |||||||||||||||||||||||||||
|
andre.powroznik@capgemini.com that's odd. I have just tried this aggregation (note the line exported from Compass):
and I had no issues. Is it possible that perhaps there is something wrong with the eq you are importing? For your reference, I also attached the collection I am running this against: users.json |