public Document toSort(List<OrderSpecifier<?>> orderBys) {
        Document sort = new Document();
        for (OrderSpecifier<?> orderBy : orderBys) {
            Object key = orderBy.getTarget().accept(this, null);
            sort.append(key.toString(), orderBy.getOrder() == Order.ASC ? 1 : -1);
        }
        return sort;
    }
Serializes the given Querydsl query to a Document query for MongoDB.

@author Mark Paluch
querydsl-mongodb/src/main/java/com/querydsl/mongodb/document/MongodbDocumentSerializer.java