Hi Mike and Stanislav,
There is no annotation for indexes, it has to be coded manually. I do intend on providing a simpler API for creating indexes (currently it's very simple for single field ascending, but multiple fields, or sparse indexes etc require stuff like
coll.ensureIndex(new BasicDBObject("someField", 1).append("someOtherField", -1),
new BasicDBObject("unique", true).append("sparse", true).append("name", "somename"));
which is obviously not very nice.
As for providing this functionality via annotations on fields, it is not very straight forward to do by design. The mongo jackson mapper was designed to fully utilise Jackson to do all serialisation/deserialisation. Consequently, it does very little reflection and inspection of annotations itself, providing it the ability to do this would potentially mean duplicating all the Jackson introspection of classes, though there may be some ways to hack it. Consequently, while it may be something I might consider doing in the future, it's very low on my priorities.
Another thing to consider, after briefly reading over the Morphia docs it seems that morphia doesn't support multi field indexes, nor does it support sparse indexes.
Cheers,
James