Java regex - json can't serialize type exception

604 views
Skip to first unread message

sp

unread,
Dec 19, 2009, 12:07:05 AM12/19/09
to mongodb-user
For:

Pattern pattern = Pattern.compile("" + "ct" + ".*",
Pattern.CASE_INSENSITIVE);
query.append("sd.fieldName",pattern);


I get:

Exception in thread "main" java.lang.RuntimeException: json can't
serialize type : class java.util.regex.Pattern
at com.mongodb.util.JSON.serialize(JSON.java:149)
at com.mongodb.util.JSON.serialize(JSON.java:102)
at com.mongodb.util.JSON.serialize(JSON.java:22)
at com.mongodb.BasicDBObject.toString(BasicDBObject.java:200)
at java.lang.String.valueOf(String.java:2827)
at java.lang.StringBuilder.append(StringBuilder.java:115)


FYI

Keith Branton

unread,
Dec 19, 2009, 12:32:01 AM12/19/09
to mongodb-user
This sounds like a problem I reported a few weeks ago:

http://jira.mongodb.org/browse/JAVA-57

If it is the same problem then it was fixed in the 1.1 java driver.

Reply all
Reply to author
Forward
0 new messages