Uploaded image for project: 'Documentation'
  1. Documentation
  2. DOCS-9478

Docs for SERVER-27152: Accept expressions (e.g. $range) for the 'boundaries' argument to $bucket.

    XMLWordPrintableJSON

Details

    • Icon: Task Task
    • Resolution: Incomplete
    • Icon: Major - P3 Major - P3
    • None
    • None
    • None
    • None

    Description

      Engineering Ticket 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.

      Attachments

        Activity

          People

            jonathan.destefano@mongodb.com Jonathan DeStefano
            emily.hall Emily Hall
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              6 years, 3 weeks, 4 days ago