I am using the $in clause within a mongodb query. However, I want my results to be ordered exactly as my input list used in the $in clause.
The results I get back are in the order the objects were inserted.
All the documentation I have read so far tells me that the sort cursor function only works with document fields. Does this mean that I cannot do the above?
MongoDB does not insert in any particular order. You can sort your results though.
See:
http://www.mongodb.org/display/DOCS/Advanced+Queries#AdvancedQueries-%24in