(Feature) Develop functions for formatting ($format) and mapping ($map)

XMLWordPrintableJSON

    • Query Optimization
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      It would be helpful to have formatting and mapping functions in aggregations and queryes.

      Formating ex:

      { $format: [ <string_format>, <arg1>, <arg2>, ... ] }
      db.data.aggregate( { $group: { _id : { $format: [ "{00:0}/{0000:0}", { $month : "$item.CreatedDate" }, { $year : "$item.CreatedDate" }] } } });
      

      Mapping ex:

      { $map: [ <value>, { <from>, <to> }, { <from>, <to> }, ... ] }
      db.data.aggregate( { $group: { _id : { $map: [ { $month : "$item.CreatedDate" }, { 1 : "January" }, { 2, "February" }, ...] } } });
      

      or

      { $map: [ <value>, { <from>, <to> }, { <from>, <to> }, ... ] }
      db.data.aggregate( { $group: { _id : { $map: [ { $month : "$item.CreatedDate" }, { 1 : "1º Quarter" }, { 2, "1º Quarter" }, ...] } } });
      

              Assignee:
              [DO NOT USE] Backlog - Query Optimization
              Reporter:
              Ricardo Planer
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated: