Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-13400

Allow $slice operator in aggregation pipeline

    • Type: Icon: New Feature New Feature
    • Resolution: Duplicate
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: 2.4.8
    • Component/s: Aggregation Framework
    • None

      I'm trying to get the top (and bottom) N cities, sorted by population and grouped by year.

      After some $sorts's, $group's and $push's, I've got something like this:

      {_id: "2013",
      cities:[

      Unable to find source-code formatter for language: "mex", ppl_m: 20. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
      
      

      ,

      Unable to find source-code formatter for language: "pue", ppl_m: 5. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
      
      

      , ...
      ]},...

      Now, I want to do perform {$project: {cities: {$slice: N}}}

      I think the $project operator should accept all of the operators the projection document does in the find() command

            Assignee:
            Unassigned Unassigned
            Reporter:
            antonimmo Antonio Quintana
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: