MongoDB Aggregation - Does $unwind order documents the same way as the nested array order?

Hi @michael_hoeller

I know the existence of includeArrayIndex option. However I would like to avoid application level sorting. So, saying in other words:

Is there any chance that this:

{ "_id" : 1, "item" : "foo", values: [ "foo", "foo2", "foo3"] }

may be destructed to this.

{ "_id" : 1, "item" : "foo", values: "foo2", "arrayIndex" : NumberLong(1 }
{ "_id" : 1, "item" : "foo", values: "foo", "arrayIndex" : NumberLong(0 }
{ "_id" : 1, "item" : "foo", values: "foo3", "arrayIndex" : NumberLong(2 }

Take a look at the order (1 0 2)

Having only the index won’t solve our problem. We need application level sorting if the above sequence is returned.
Best Regards
Aleydin