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

Investigate changes in SERVER-67284: $fill.partitionByFields does not allow the dot notation for embedded documents

      Original Downstream Change Summary

      This enables an additional way of specifying partitions in $fill

      Description of Linked Ticket

      The following experiment run in mongosh against MongoDB 5.3.1

      use myDb
      db.myColl.drop()
      db.runCommand({"insert": "myColl", "documents": [
          {"_id": 1, "partition": {"id": 10}, "field": 1},
          {"_id": 2, "partition": {"id": 10}},
          {"_id": 3, "partition": {"id": 20}, "field": 3}] })
      db.runCommand({"aggregate": "myColl", "pipeline": [
          {"$fill": {
              "output": {
                  "field": {"method": "locf"}
              },
              "sortBy": {"_id": -1},
              "partitionByFields": ["partition.id"] }},
          {"$sort": {"_id": 1}},
          {"$project": {"field": true, "_id": false} }],
          "cursor": {} })
      

      results in

      MongoServerError: FieldPath field names may not contain '.'. Consider using $getField or $setField.
      

      Replacing

      "partitionByFields": ["partition.id"]
      

      with

      "partitionBy": {"p": "$partition.id"}
      

      makes it work and produce

      [ { field: 1 }, { field: null }, { field: 3 } ]
      

      kateryna.kamenieva@mongodb.com confirmed that this is a bug and the dot notation for embedded documents was intended to be supported in $fill.partitionByFields similarly to how it is supported in $densify.partitionByFields:

            Assignee:
            Unassigned Unassigned
            Reporter:
            backlog-server-pm Backlog - Core Eng Program Management Team
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              1 year, 38 weeks, 6 days ago