Unwind with unknown field values

I’ve already done one step of the aggregation pipeline to isolate player information from an NFL game. I have no control over the format the API returns to me otherwise I would simply correct for this.

I would like each integer: object combination to become its own document so I can simply iterate through each document in java and get the information I want. Additionally, because each of these integers represents a player in an NFL season, each integer has the potential of showing up nearly 20 times when the player information is isolated from the game information completely.

Hi @Dylan_Wolfer

My idea would be to do a $set with an Object to Array on the playerStats field then $unwind and $replaceRoot

https://mongoplayground.net/p/v0ppoDAqkir

edit: Whoops. I didn’t read this piece. Do you know what the schema would look like with each game(?) data present ?