Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-2224

JsonReader does not support BsonRegularExpression

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • 3.5.0
    • Affects Version/s: 3.0.0
    • Component/s: JSON
    • None

      When trying to parse the following query:

      { $query : { author : { $regex : /^Oscar/ } }, $orderby : { name : 1 } }
      

      we end up with the following error:

      org.bson.json.JsonParseException: JSON reader expected a string but found 'BsonRegularExpression{pattern='^Oscar', options=''}'.
      	at org.bson.json.JsonReader.visitRegularExpressionExtendedJson(JsonReader.java:940)
      	at org.bson.json.JsonReader.visitExtendedJSON(JsonReader.java:587)
      	at org.bson.json.JsonReader.readBsonType(JsonReader.java:139)
      

      This is due to the fact that JsonReader#visitRegularExpressionExtendedJson is not prepared to get directly an already parsed BsonRegularExpression.

      This is kinda annoying because we can't support this type of native query in Hibernate OGM.

      PR to come.

            Assignee:
            Unassigned Unassigned
            Reporter:
            gsmet Guillaume Smet
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: