Skip to content
This repository has been archived by the owner on Jan 21, 2022. It is now read-only.

Commit

Permalink
Fix conversions namespaces in tutorial
Browse files Browse the repository at this point in the history
  • Loading branch information
ornicar committed Dec 13, 2011
1 parent 9e7ddaa commit 2d13a47
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions tutorial_src/source/tutorial.rst
Original file line number Original file line Diff line number Diff line change
@@ -1,5 +1,4 @@



************************* *************************
Tutorial: Using Casbah Tutorial: Using Casbah
************************* *************************
Expand All @@ -26,17 +25,17 @@ As we mentioned, as soon as you construct a ``MongoConnection`` object, a few ty


As many Scala developers tend to prefer `Joda time <http://joda-time.sourceforge.net/>`_ over JDK Dates, you can also explicitly enable serialization and deserialization of them (w/ full support for the `Scala-Time wrappers <http://github.com/jorgeortiz85/scala-time>`_) by an explicit call:: As many Scala developers tend to prefer `Joda time <http://joda-time.sourceforge.net/>`_ over JDK Dates, you can also explicitly enable serialization and deserialization of them (w/ full support for the `Scala-Time wrappers <http://github.com/jorgeortiz85/scala-time>`_) by an explicit call::


import com.mongodb.casbah.conversions.scala._ import com.mongodb.casbah.commons.conversions.scala._
RegisterJodaTimeConversionHelpers() RegisterJodaTimeConversionHelpers()


Once these are loaded, Joda Time (and Scala Time wrappers) will be saved to MongoDB as proper BSON Dates, and on retrieval/deserialization all BSON Dates will be returned as Joda ``DateTime`` instead of a JDK Date (aka `java.util.Date`). Because this can cause problems in some instances, you can explicitly unload the Joda Time helpers:: Once these are loaded, Joda Time (and Scala Time wrappers) will be saved to MongoDB as proper BSON Dates, and on retrieval/deserialization all BSON Dates will be returned as Joda ``DateTime`` instead of a JDK Date (aka `java.util.Date`). Because this can cause problems in some instances, you can explicitly unload the Joda Time helpers::


import com.mongodb.casbah.conversions.scala._ import com.mongodb.casbah.commons.conversions.scala._
DeregisterJodaTimeConversionHelpers() DeregisterJodaTimeConversionHelpers()


And reload them later as needed. If you find you need to unload the other helpers as well, you can load and unload them just as easily:: And reload them later as needed. If you find you need to unload the other helpers as well, you can load and unload them just as easily::


import com.mongodb.casbah.conversions.scala._ import com.mongodb.casbah.commons.conversions.scala._
DeregisterConversionHelpers() DeregisterConversionHelpers()
RegisterConversionHelpers() RegisterConversionHelpers()


Expand Down

0 comments on commit 2d13a47

Please sign in to comment.