code: public static Bson convertToBson(final Constraints.ConstraintHost fields) {
      if (fields instanceof JsonQuery) {
        return (Bson) fields;
      }
      return fields.accept(new ConstraintBuilder("")).asDocument();
    }
docs: Given a query / ordering clause will convert it to Bson representation.