private BasicDBObject parseFieldsString(final String fields) {
        BasicDBObjectBuilder ret = BasicDBObjectBuilder.start();
        final String[] parts = fields.split(",");
        for (String s : parts) {
            s = s.trim();
            int dir = 1;
            if (s.startsWith("-")) {
                dir = -1;
                s = s.substring(1).trim();
            }
            ret = ret.add(s, dir);
        }
        return (BasicDBObject) ret.get();
    }
Ensures (creating if necessary) the index including the field(s) + directions; eg fields = "field1, -field2" ({field1:1, field2:-1})
lts-core/src/main/java/com/github/ltsopensource/store/mongo/MongoTemplate.java