Permalink
Browse files

Release r2.0.1

  • Loading branch information...
1 parent 9c22286 commit f46494790f9cc427c9a1055af6f393488fece584 Brendan W. McAdams committed Jan 4, 2011
View
@@ -1,4 +1,10 @@
+2.0.1 / 2011-01-04
+==================
+
+ * SCALA-16: Added a few additional validation tests against getAs and as on MongoDBObject
+ * SCALA-17 - Fixed syntax of $within and its nested operators, unit test passes
+
2.0 / 2011-01-03
==================
View
@@ -0,0 +1,7 @@
+
+Casbah 2\.0\.1 / 2011-01-04
+==================
+
+ * SCALA-16: Added a few additional validation tests against getAs and as on MongoDBObject
+ * SCALA-17 - Fixed syntax of $within and its nested operators, unit test passes
+
View
@@ -3,7 +3,7 @@
project.organization=com.mongodb.casbah
project.name=casbah
sbt.version=0.7.4
-project.version=2.0
+project.version=2.0.1
def.scala.version=2.7.7
build.scala.versions=2.8.1 2.8.0
project.initialize=false
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
#
# Casbah (MongoDB Scala Toolkit) Tutorial documentation build configuration file, created by
-# sphinx-quickstart on Thu Dec 9 12:09:28 2010.
+# sphinx-quickstart on Thu Dec 9 12.0.19:28 2010.
#
# This file is execfile()d with the current directory set to its containing dir.
#
@@ -51,7 +51,7 @@
# The short X.Y version.
version = '2.0'
# The full version, including alpha/beta/rc tags.
-release = '2.0'
+release = '2.0.1'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
@@ -1,5 +1,5 @@
.. Casbah (MongoDB Scala Toolkit) Tutorial documentation master file, created by
- sphinx-quickstart on Thu Dec 9 12:09:28 2010.
+ sphinx-quickstart on Thu Dec 9 12.0.19:28 2010.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
@@ -12,23 +12,23 @@ Casbah's approach is intended to add fluid, Scala-friendly syntax on top of Mong
Casbah provides improved interfaces to GridFS, Map/Reduce and the core Mongo APIs. It also provides a fluid query syntax which emulates an internal DSL and allows you to write code which looks like what you might write in the JS Shell. There is also support for easily adding new serialization/deserialization mechanisms for common data types (including Joda Time, if you so choose; with some caveats - See the GridFS Section).
-With version 2.0, Casbah has become an official MongoDB project and will continue to improve the interaction of Scala + MongoDB. Casbah aims to remain fully compatible with the existing Java driver---it does not talk to MongoDB directly, preferring to wrap the Java code. This means you shouldn't see any wildly unexpected behavior from the underlying Mongo interfaces when a data bug is fixed.
+With version 2.0.1, Casbah has become an official MongoDB project and will continue to improve the interaction of Scala + MongoDB. Casbah aims to remain fully compatible with the existing Java driver---it does not talk to MongoDB directly, preferring to wrap the Java code. This means you shouldn't see any wildly unexpected behavior from the underlying Mongo interfaces when a data bug is fixed.
-The `ScalaDocs for Casbah <http://api.mongodb.org/scala/casbah/2.0/scaladoc/>`_ along with SXR cross referenced source are available at the `MongoDB API site <http://api.mongodb.org>`_.
+The `ScalaDocs for Casbah <http://api.mongodb.org/scala/casbah/2.0.1/scaladoc/>`_ along with SXR cross referenced source are available at the `MongoDB API site <http://api.mongodb.org>`_.
.. TODO - links to prior releases?
You may also download this documentation in other formats.
- * `ePub <http://api.mongodb.org/scala/casbah/2.0/CasbahDocumentation.epub>`_
- * `PDF <http://api.mongodb.org/scala/casbah/2.0/CasbahDocumentation.pdf>`_
+ * `ePub <http://api.mongodb.org/scala/casbah/2.0.1/CasbahDocumentation.epub>`_
+ * `PDF <http://api.mongodb.org/scala/casbah/2.0.1/CasbahDocumentation.pdf>`_
.. toctree::
:maxdepth: 3
:numbered:
- API Docs <http://api.mongodb.org/scala/casbah/2.0/scaladoc/>
+ API Docs <http://api.mongodb.org/scala/casbah/2.0.1/scaladoc/>
setting_up
tutorial
@@ -37,7 +37,7 @@ You may also download this documentation in other formats.
.. Indices and tables
.. ==================
..
-.. * `API Docs <http://api.mongodb.org/scala/casbah/2.0/scaladoc/>`_
+.. * `API Docs <http://api.mongodb.org/scala/casbah/2.0.1/scaladoc/>`_
.. * :ref:`genindex`
.. * :ref:`modindex`
.. * :ref:`search`
@@ -4,7 +4,7 @@ Getting Started
Installing & Setting up Casbah
==============================
-You should have `MongoDB <http://mongodb.org>`_ setup and running on your machine (these docs assume you are running on *localhost* on the default port of *27017*) before proceeding. If you need help setting up MongoDB please see `the MongoDB quickstart install documentation <http://www.mongodb.org/display/DOCS/Quickstart>`_.
+You should have `MongoDB <http://mongodb.org>`_ setup and running on your machine (these docs assume you are running on *localhost* on the default port of *2.0.117*) before proceeding. If you need help setting up MongoDB please see `the MongoDB quickstart install documentation <http://www.mongodb.org/display/DOCS/Quickstart>`_.
To start with, you need to either download the latest Casbah driver and place it in your classpath, or set it up in the dependency manager/build tool of your choice (The authors highly recommend the Scala `simple-build-tool <http://code.google.com/p/simple-build-tool/>`_ - it makes Scala development easy).
@@ -19,7 +19,7 @@ You can always get the latest source for Casbah from `the github repository <htt
$ git clone git://github.com/mongodb/casbah
-*PLEASE NOTE*: As of the 2.0 release, Casbah has been broken into
+*PLEASE NOTE*: As of the 2.0.1 release, Casbah has been broken into
several modules which can be used to strip down which features you need. For example, you can use the Query DSL independent of the GridFS implementation if you wish. The following dependency manager information uses the master artifact which downloads and uses *all* of Casbah's modules by default.
Using Dependency/Build Managers
@@ -42,15 +42,15 @@ Scala 2.8.0 users::
<dependency>
<groupId>com.mongodb.casbah<groupId>
<artifactId>casbah_2.8.0<artifactId>
- <version>2.0<version>
+ <version>2.0.1<version>
<dependency>
Scala 2.8.1 users::
<dependency>
<groupId>com.mongodb.casbah<groupId>
<artifactId>casbah_2.8.1<artifactId>
- <version>2.0<version>
+ <version>2.0.1<version>
<dependency>
@@ -60,29 +60,29 @@ You can add Casbah to Ivy with the following dependency block.
Scala 2.8.0 users::
- <dependency org="com.mongodb.casbah" name="casbah_2.8.0" rev="2.0"/>
+ <dependency org="com.mongodb.casbah" name="casbah_2.8.0" rev="2.0.1"/>
Scala 2.8.1 users::
- <dependency org="com.mongodb.casbah" name="casbah_2.8.1" rev="2.0"/>
+ <dependency org="com.mongodb.casbah" name="casbah_2.8.1" rev="2.0.1"/>
Setting up SBT
---------------
Finally, you can add Casbah to SBT by adding the following to your project file::
- val casbah = "com.mongodb.casbah" %% "casbah" % "2.0"
+ val casbah = "com.mongodb.casbah" %% "casbah" % "2.0.1"
The double percentages (`%%`) is not a typo---it tells SBT that the library is crossbuilt and to find the appropriate version for your project's Scala version. If you prefer to be explicit you can use this instead::
// Scala 2.8.0
- val casbah = "com.mongodb.casbah" % "casbah_2.8.0" % "2.0"
+ val casbah = "com.mongodb.casbah" % "casbah_2.8.0" % "2.0.1"
// Scala 2.8.1
- val casbah = "com.mongodb.casbah" % "casbah_2.8.1" % "2.0"
+ val casbah = "com.mongodb.casbah" % "casbah_2.8.1" % "2.0.1"
Don't forget to reload the project and run ``sbt update`` afterwards to download the dependencies (SBT doesn't check every build like Maven).
-Migrating to Casbah 2.0 from Casbah 1.x
+Migrating to Casbah 2.0.1 from Casbah 1.x
========================================
If you used Casbah before, and are looking to migrate from Casbah 1.x to Casbah 2.x
@@ -91,12 +91,12 @@ there are some things which have changed and you should be aware of to effective
Base Package Name
------------------
For starters, the base package has changed. The now abandoned 1.1.x branch which
-became 2.0 was already doing a package change, and with 2.0 Casbah has become a
-supported MongoDB project. As a result, Casbah's package has changed for the 2.0
+became 2.0.1 was already doing a package change, and with 2.0.1 Casbah has become a
+supported MongoDB project. As a result, Casbah's package has changed for the 2.0.1
release and you will need to update your code accordingly:
=========================== =============================== =====================
-Casbah 1.0.x Casbah 1.1.x (never released) Casbah 2.0
+Casbah 1.0.x Casbah 1.1.x (never released) Casbah 2.0.1
=========================== =============================== =====================
com.novus.casbah.mongodb com.novus.casbah com.mongodb.casbah
=========================== =============================== =====================
@@ -116,7 +116,7 @@ Previously, it was possible with Casbah to cast Tuples to :dochub:`DBObject`::
val x: DBObject = ("foo" -> "bar", "x" -> 5, "y" -> 238.1)
-This feature was provided by implicit conversions which attempt to target `Product` which is the base class of all Tuples. Unfortunately, this functionality was often unreliable and targeted the wrong things for conversion (Such as instances of `Option[_]`). After a lot of evaluation and attempts to create a better approach a decision was made to remove this feature. Casbah 2.0 includes wrappers for :dochub:`DBObject` which follow Scala 2.8's Collection interfaces including Scala compatible builders and constructors. As such, the same previous syntax is possible by passing the Tuple pairs to `MongoDBObject.apply`::
+This feature was provided by implicit conversions which attempt to target `Product` which is the base class of all Tuples. Unfortunately, this functionality was often unreliable and targeted the wrong things for conversion (Such as instances of `Option[_]`). After a lot of evaluation and attempts to create a better approach a decision was made to remove this feature. Casbah 2.0.1 includes wrappers for :dochub:`DBObject` which follow Scala 2.8's Collection interfaces including Scala compatible builders and constructors. As such, the same previous syntax is possible by passing the Tuple pairs to `MongoDBObject.apply`::
val x: DBObject = MongoDBObject("foo" -> "bar", "x" -> 5, "y" -> 238.1)
/* x: com.mongodb.casbah.Imports.DBObject = { "foo" : "bar" , "x" : 5 , "y" : 238.1} */
@@ -149,7 +149,7 @@ New Features
Query DSL Operators
^^^^^^^^^^^^^^^^^^^^
-Casbah previously lagged behind the official MongoDB server in supported :ref:`Query DSL <casbah-query>` `$ Operators`. As of 2.0, all `$ Operators` currently documented as supported in MongoDB are provided. A list of some of the new operators added in 2.0 include:
+Casbah previously lagged behind the official MongoDB server in supported :ref:`Query DSL <casbah-query>` `$ Operators`. As of 2.0.1, all `$ Operators` currently documented as supported in MongoDB are provided. A list of some of the new operators added in 2.0.1 include:
* :dochub:`$slice`
* :dochub:`$or`
@@ -170,7 +170,7 @@ Previously, the correct syntax for using :dochub:`$not` was::
"foo".$not $gte 15 $lt 35.2 $ne 16
-With Casbah 2.0, this syntax has been modified to be more clear to both the developer *and* the compiler::
+With Casbah 2.0.1, this syntax has been modified to be more clear to both the developer *and* the compiler::
"foo" $not { _ $gte 15 $lt 35.2 $ne 16 }
@@ -232,7 +232,14 @@ We cover the import of each module in their appropriate tutorials, but each modu
import com.mongodb.casbah.query.Imports._
-The full set of changes between 1.0.x and 2.0:
+The full set of changes between 1.0.x and 2.x:
+
+Casbah 2\.0\.1 / 2011-01-04
+==================
+
+ * SCALA-16: Added a few additional validation tests against getAs and as on MongoDBObject
+ * SCALA-17 - Fixed syntax of $within and its nested operators, unit test passes
+
Casbah 2\.0 / 2011-01-03
@@ -17,7 +17,7 @@ Now that you've added Casbah to your project, it should be available for import.
import com.mongodb.casbah.Imports._
-That's it. Most of what you need to work with Casbah is now at hand. .. If you want to know what's going on inside the ``Imports._`` take a look at `Implicits.scala <http://api.mongodb.org/scala/casbah/2.0/scaladoc/casbah-core/sxr/Implicits.scala.html>`_ which defines it.
+That's it. Most of what you need to work with Casbah is now at hand. .. If you want to know what's going on inside the ``Imports._`` take a look at `Implicits.scala <http://api.mongodb.org/scala/casbah/2.0.1/scaladoc/casbah-core/sxr/Implicits.scala.html>`_ which defines it.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Briefly: Automatic Type Conversions
@@ -54,16 +54,16 @@ Connecting to MongoDB
The core Connection class as you may have noted above is ``com.mongodb.casbah.MongoConnection``. There are two ways to create an instance of it. First, you can invoke ``.asScala`` from a MongoDB builtin Connection (``com.mongodb.Mongo``). This method is provided via implicits. The pure Scala way to do it is to invoke one of the ``apply`` methods on the companion object::
- // Connect to default - localhost, 27017
+ // Connect to default - localhost, 2.0.117
val mongoConn = MongoConnection()
// mongoConn: com.mongodb.casbah.MongoConnection
// connect to "mongodb01" host, default port
val mongoConn = MongoConnection("mongodb01")
// mongoConn: com.mongodb.casbah.MongoConnection
- // connect to "mongodb02" host, port 42001
- val mongoConn = MongoConnection("mongodb02", 42001)
+ // connect to "mongodb02" host, port 42.0.11
+ val mongoConn = MongoConnection("mongodb02", 42.0.11)
// mongoConn: com.mongodb.casbah.MongoConnection
If you imported ``Imports._``, you already have ``MongoConnection`` in scope and won't require additional importing. These all return an instance of the ``MongoConnection`` class, which provides all the methods as the Java ``Mongo`` class it proxies (which is available from the ``underlying`` attribute, incidentally) with the addition of having an apply method for getting a DB instead of calling ``getDB()``::
@@ -263,7 +263,7 @@ retrieving just the username::
val fields = MongoDBObject("user" -> 1)
for (x <- mongoColl.find(q, fields)) println(x)
/* { "_id" : { "$oid" : "4d190356b9d8ba42efa80898"} , "user" : "bwmcadams"}
- { "_id" : { "$oid" : "4d190356b9d8ba42f0a80898"} , "user" : "someOtherUser"} */
+ { "_id" : { "$oid" : "4d190356b9d8ba42.0.1a80898"} , "user" : "someOtherUser"} */
As is standard with MongoDB, you always get back the ``_id`` field, whether you want it or not. You may also note one other "Scala 2.8" collection feature above - ``empty``. ``MongoDBObject.empty`` will always give you back a... (you guessed it!) empty ``DBObject``. This tends to be useful working with MongoDB with certain tasks such as an empty query (all entries) with limited fields.
@@ -312,10 +312,10 @@ You also can chain operators for an "and" type query... I often find myself look
// MongoCursor{Iterator[DBObject] with 2 objects.}
for (x <- rangeColl.find("foo" $lt 50 $gt 5) ) println(x)
// { "_id" : { "$oid" : "4c42426f30daeca8efe48de8"} , "foo" : 30}
- // { "_id" : { "$oid" : "4c42427030daeca8f0e48de8"} , "foo" : 35}
+ // { "_id" : { "$oid" : "4c4242.0.130daeca8f0e48de8"} , "foo" : 35}
for (x <- rangeColl.find("foo" $lte 50 $gt 5) ) println(x)
// { "_id" : { "$oid" : "4c42426f30daeca8efe48de8"} , "foo" : 30}
- // { "_id" : { "$oid" : "4c42427030daeca8f0e48de8"} , "foo" : 35}
+ // { "_id" : { "$oid" : "4c4242.0.130daeca8f0e48de8"} , "foo" : 35}
// { "_id" : { "$oid" : "4c42427330daeca8f1e48de8"} , "foo" : 50}
You can get the idea pretty quickly that with these "core" operators you can do some pretty fantastic stuff. What if I want fluidity on multiple fields? In that case, use the ``++`` additivity operator to combine multiple blocks.::

0 comments on commit f464947

Please sign in to comment.