Open ledomi opened 5 years ago
Hi All,
I think that validation for aggregation with $size is invalid. Step by step:
Fongo version: 2.1.1
My collection:
[{ "_id": 5b894357a0c84d5a5d221f25, "conferenceName": "myFirstConference", "startDate": 1535722327, "endDate": 1535722420, "participants": [{ "name": "user1", "origin": "internal", "ip": "192.168.0.2" }, { "name": "user2", "origin": "external", "ip": "172.20.0.3" },{ "name": "user3", "origin": "internal", "ip": "192.168.0.3" }, ] } ]
My mongo query that works is :
db.collection.aggregate([{ "$project": { "conferenceName": 1, "startDate": 1, "endDate": 1, "internalUsersCount": { "$size": { "$filter": { "input": "$participants", "as": "part", "cond": { "$eq": ["$$part.origin", "internal"] } } } } } }])
In that case as an input we have a LinkedHasMap not List but parsing was implementet as below
class ProjectedSize ..... private String parseOperand(Object value) { if (!(value instanceof String) && (!(value instanceof List) || ((List) value).size() != 1)) { errorResult(coll, 16020, "the " + keyword + " operator requires an array of 1 operand"); } }
But it doesn't work in fongo, Anybody can help ?
Hi All,
I think that validation for aggregation with $size is invalid. Step by step:
Fongo version: 2.1.1
My collection:
My mongo query that works is :
In that case as an input we have a LinkedHasMap not List but parsing was implementet as below
But it doesn't work in fongo, Anybody can help ?