I've make this work on some parts it was documented but wasn't working and I've added and documented on ensure_index().
I've also added some tests for these features. Please let me know if there is something I've missed.
This has become out of date with our current codebase. In Collection.pm we allow arrays in to_index_string. Regarding Cursor.pm, I don't think the behavior of the _hash_or_sorted is particularly useful now. We document that the user should use Tie::IxHash if order matters and a IxHash can be deliberately made on the user's end. I do think that something needs to be done about Cursor::sort allowing hash refs since this can be a problem.
If you want, take a look at Collection::find and how it converts an array ref to an IxHash. Doing something similar for Cursor::sort and documenting the fact that the array ref needs to have an even number of elements would be beneficial. There should also be a warning that using hash refs can cause an unexpected sort result since ordering is in no way guaranteed by perl.
Wow, has been 2y last ween since I've proposed this change!. Thank you for a response :-)
I'll read more carefully your response looking at current implementation since I still feel that something in this line would be a nice to have.
Hope to come back in less than 2y ! :-p
I've created a Jira ticket (PERL-397) to track the broader issue that we need consistent treatment of ordered document arguments.