Why DynamicDBObject not supported Date and Regex?

39 views
Skip to first unread message

kenji yoshida

unread,
Jul 27, 2011, 6:48:57 AM7/27/11
to mongodb-casbah-users
The BSON is not only "just JSON" ,but also included Date and Regex.

However , DynamicDBObject class's defaultCaster method not supported
Date and Regex.

https://github.com/mongodb/casbah/blob/07c91eeda8ebe28a7d13689358959e9c1d5a1776/casbah-dynamic/src/main/scala/DynamicDBObject.scala#L42-55

why not supported ?

If I want use Date or Regex , extends DynamicDBObject, and override
defaultCaster method ?

defaultCaster method should suppot Date and Regex ?




Brendan W. McAdams

unread,
Jul 27, 2011, 11:52:42 AM7/27/11
to mongodb-ca...@googlegroups.com
On Wed, Jul 27, 2011 at 6:48 AM, kenji yoshida <6b656...@gmail.com> wrote:
The BSON is not only "just JSON" ,but also included Date and Regex.


Yes, I'm aware.
 
However , DynamicDBObject class's defaultCaster method not supported
Date and Regex.

https://github.com/mongodb/casbah/blob/07c91eeda8ebe28a7d13689358959e9c1d5a1776/casbah-dynamic/src/main/scala/DynamicDBObject.scala#L42-55

why not supported ?


Because the Dynamic module is still experimental, and we simply didn't add it in.  Feel free to open a ticket in the Scala project at http://jira.mongodb.org to request the feature addition.
 
If I want use Date or Regex , extends DynamicDBObject, and override
defaultCaster method ?


Yes, this would be the recommended approach.  You might consider using orElse in your override, so that your overridden method adds just the types you want and then invokes orElse super.defaultCaster to chain. 

kenji yoshida

unread,
Jul 27, 2011, 9:36:17 PM7/27/11
to mongodb-casbah-users
I see .
Thank you :)
Reply all
Reply to author
Forward
0 new messages