Uploaded image for project: 'Python Integrations'
  1. Python Integrations
  2. INTPYTHON-38

Add support for custom projections for find_arrow_all

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Unknown Unknown
    • 0.2.0
    • Affects Version/s: None
    • Component/s: None

      Starting in MongoDB 4.4 you can use aggregation expressions in projections for find. For example, to flatten some fields in a document:

      >>> client.t.t.find_one({}, {'windDirection': '$wind.direction.angle', 'windSpeed': '$wind.speed.rate'})
      {'_id': ObjectId('5553a998e4b02cf7151190bf'), 'windDirection': 100, 'windSpeed': 3.1}
      

      Unfortunately this does not work with pymongoarrow because it supplies its own custom projection:

      >>> client.t.t.find_arrow_all({}, schema=Schema({'windDirection': int, 'windSpeed': float}), projection={'windDirection': '$wind.direction.angle', 'windSpeed': '$wind.speed.rate'})
      <stdin>:1: UserWarning: Ignoring option 'projection' as it is not supported by PyMongoArrow
      pyarrow.Table
      windDirection: int64
      windSpeed: double
      

      We should add support for custom projections to find_arrow_all and friends.

            Assignee:
            steve.silvester@mongodb.com Steve Silvester
            Reporter:
            shane.harvey@mongodb.com Shane Harvey
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: