I am using mongodb and querying a db using bucket stage with aggregation.
mongodb version :
db.serverBuildInfo()
{
"version" : "3.6.0",
"versionArray" : [
3.0,
6.0,
0.0,
0.0
],
"bits" : 64.0,
"maxBsonObjectSize" : 16777216.0,
"ok" : 1.0
}
My query is :
db.data.aggregate(
[
{
"$bucket":
{
groupBy: "$h_id",
boundaries: [ 0, 100, 200, 300],
default: "Other",
output: {
"count": { $sum: 1 },
}
}
},
]);
I am getting error:
Unable to execute the selected commands
Mongo Server error (MongoCommandException): Command failed with error 304: 'Aggregation stage not supported: '$bucket'' on server mongodb-test:27017.
The full response is: { "ok" : 0.0, "errmsg" : "Aggregation stage not supported: '$bucket'", "code" : NumberInt(304) }
In document I can see that bucket is included in mongodb from version 3.4. https://docs.mongodb.com/v3.6/reference/operator/aggregation/bucket/
Can any body point out what is the reason of this error...