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

Docs for SERVER-9406: Allow treating ObjectId type as date in $project phase

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Resolved
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.5.9
    • Component/s: None
    • Labels:
    • # Replies:
      1
    • Last comment by Customer:
      true
    • Sprint:
      KANBAN BUCKET

      Description

      Documentation Request Summary:

      Aggregation date expressions will accept input of type ObjectId.

      Engineering Ticket Description:

      Since ObjectId() encompasses an approximation of insertion date it would be helpful if _id/things of ObjectId() type could be operated/projected the same way as Datetime type object.

      {case}
      {$project:{$year:"$_id"}} would extract year out of ObjectId().getTimestamp equivalent.{case}

      One question would be whether ObjectId could be operated on directly via date/interval arithmetic. I.e. whether it can be used anywhere a date can be used returning a standard Datetime type as a result from say {$subtract:["$_id",86400000]} which can only return ts of one day before that ObjectId's timestamp.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              kevin.albertson Kevin Albertson
              Reporter:
              emily.hall Emily Hall
              Participants:
              Last commenter:
              Kevin Albertson
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Days since reply:
                2 years, 37 weeks, 5 days ago
                Date of 1st Reply: