Does MongoDB preserve array order in document

Does MongoDB preserve the order of the elements in an array?

I have a document with the following structure:

{
    myArray: [1, 2, 3]
}

When I query by ID (no aggregation/projection/no operations on any fields), is it guaranteed that I will receive the array in the order in which I stored it with? Ideally, if someone could point me towards some documentation that states this, that would be great.

See

1 Like