I've been working with the Pipe() method successfully, however I would like to crate a conditional aggregate using $sum in the $group part of an aggregation framework query.
This is a snippet of the grouping section:
"_id": bson.M {}, // is filled separately - assume this works :-)
"$Code": bson.M{"$eq": 200},
I am getting an emtpy result set with the "Success" section included (if I remove it, I get a dataset) - however I can't seem to figure out how to get the conditional method to work correctly - I've lifted the above pretty much from the mongo documentation (all fields are present, I've checked by summing the $Code field).
I have also tried reversing the if clause so that it is:
"if": bson.M{"$eq": 200},
So I don't think it's that. All documentation indicates that the $eq operator in this context takes an array - but I can;t seem to figure out how to pass an array into the query, so I'm not sure if that's what I am doing wrong...
Any ideas would be appreciated:-)
Thanks,
Martin