[SERVER-27152] Accept expressions (e.g. $range) for the 'boundaries' argument to $bucket. Created: 21/Nov/16  Updated: 10/Jan/23

Status: Backlog
Project: Core Server
Component/s: Aggregation Framework
Affects Version/s: None
Fix Version/s: None

Type: New Feature Priority: Major - P3
Reporter: Buzz Moschetti Assignee: Backlog - Query Optimization
Resolution: Unresolved Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Assigned Teams:
Query Optimization
Participants:

 Description   

I am hoping I am simply missing something so obvious I am ignoring it.
This works:

c=db.cscl2.aggregate([
{$bucket: {"groupBy": "$length",
           boundaries: [0,5,10,15],
    default:"other" }}
                      ]);
show(c);

This does not:

                                                             
c=db.cscl2.aggregate([
{$bucket: {"groupBy": "$length",
           boundaries: {$range: [0,20,5 ]},
    default:"other" }}]);
show(c);
 "errmsg" : "The $bucket 'boundaries' field must be an array, but found type: object.",
 "code" : 40200,                                                                        
 "codeName" : "Location40200"                                                           

So changing [0,5,10,15] to {$range: [0,20,5]} creates the error.


Generated at Thu Feb 08 04:14:19 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.