Polars and pymongoarrow with embedded documents

I have an aggregation that produces data that contains embedded documents as:

{
  "_id": {
    "$oid": "65816a666771a1d4de33eb68"
  },
  "diet_included": [
    {
      "label": "banana",
      "_id": "62af112dbe66bc92f8ceabcb",
      "type": "foodLabel",
      "labelId": 46,
      "optionCategoryIdsForConflicts": [
        13200,
        90020,
        91020
      ],
      "foodLabel": "banana",
      "categoriesNames": []
    },
    {
      "label": "carrot",
      "_id": "62af113cbe66bc92f8ceac20",
      "type": "foodLabel",
      "labelId": 131,
      "optionCategoryIdsForConflicts": [
        18170,
        91010
      ],
      "foodLabel": "carrot",
      "categoriesNames": []
    },
    {
      "label": "eggplant",
      "_id": "62af115cbe66bc92f8ceacd4",
      "type": "foodLabel",
      "labelId": 311,
      "optionCategoryIdsForConflicts": [
        18080,
        61000,
        90020
      ],
      "foodLabel": "eggplant",
      "categoriesNames": []
    }
  ],
  "matchedLabels": {
    "matchBased": [
      {
        "name": "None"
      },
      {
        "name": "Pescatarian"
      },
      {
        "name": "L_Vit. A"
      }
    ],
    "noMatchedMicro": [],
    "userIncludedFoodLabels": [
      "banana",
      "carrot",
      "eggplant"
    ]
  }
}

I can successfully extract the data using the pandas library 
result = col.aggrerate(agg)
df = pandas.DataFrame(result)

However this doesnt work with polars.DataFrame or with pymongoarrow aggregate_polars_all.    

This is more of an irritant than a show stopper, but it raises the concern that  perhaps polars a) isn't compatible with 3.11 or that pymongo is the cause

So anyone gone too far on the bleeding edge?
1 Like

Thank you for the report! I have created: https://jira.mongodb.org/browse/INTPYTHON-552

1 Like