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

In { "$regex":"foo", "$options":"i" } form, $options is not optional

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 2.8.0
    • Affects Version/s: 2.7
    • Component/s: API
    • Labels:

      Core server unit tests show that it's permissible to leave off the $options field, as requested in SERVER-275 :
      https://github.com/mongodb/mongo/blob/8190d8db538c629973a3a581a97251b22b668c7a/jstests/regex2.js#L43-47

      However, Java driver will error out if one doesn't supply the $options field with a $regex query form. The following line is caller's ticket to (iirc) a NullPointerException :
      https://github.com/mongodb/mongo-java-driver/blob/master/src/main/com/mongodb/util/JSONCallback.java#L94

            Assignee:
            scotthernandez Scott Hernandez (Inactive)
            Reporter:
            dampier T. Dampier
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: