Does the $in operator preserves the order of the array?

As outlined in this document:

As the references are stored in a array, it makes sense to preserve the order.

Hi @Adriano_Tirloni,

Welcome to MongoDB community

MongoDB only gurantee order of documents based on a sort operation. Therefore, even if some queries will return the order you need it won’t be guaranteed for every query.

Thanks
Pavel