mongo/src/org/immutables/mongo/repository/internal/Support.java
public static Bson convertToBson(final Constraints.ConstraintHost fields) {
    if (fields instanceof JsonQuery) {
      return (Bson) fields;
    }
    return fields.accept(new ConstraintBuilder("")).asDocument();
  }
public static Bson convertToBson(final Constraints.ConstraintHost fields) {
    if (fields instanceof JsonQuery) {
      return (Bson) fields;
    }
    return fields.accept(new ConstraintBuilder("")).asDocument();
  }
Given a query / ordering clause will convert it to Bson representation.