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

JsonReader does not support BsonRegularExpression

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Major - P3 Major - P3
    • 3.5.0
    • 3.0.0
    • JSON
    • None

    Description

      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.

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: