Details
-
Improvement
-
Resolution: Unresolved
-
Minor - P4
-
None
-
None
-
Query Optimization
Description
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" }, ...] } } });
|