[JAVA-470] In { "$regex":"foo", "$options":"i" } form, $options is not optional Created: 13/Nov/11  Updated: 18/Jun/12  Resolved: 14/Nov/11

Status: Closed
Project: Java Driver
Component/s: API
Affects Version/s: 2.7
Fix Version/s: 2.8.0

Type: Bug Priority: Minor - P4
Reporter: T. Dampier Assignee: Scott Hernandez (Inactive)
Resolution: Done Votes: 0
Labels: query, regex
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

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



 Comments   
Comment by Jeffrey Yemin [ 18/Jun/12 ]

Closing for 2.8.0 release.

Comment by T. Dampier [ 14/Nov/11 ]

Sweet – thanks, Scott!

Comment by auto [ 14/Nov/11 ]

Author:

{u'login': u'scotthernandez', u'name': u'Scott Hernandez', u'email': u'scotthernandez@gmail.com'}

Message: JAVA-470: support without , both parsing and serializing to String
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/850b43671d7f468172527fdaba47e82ee116d711

Generated at Thu Feb 08 08:52:21 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.