Permalink
Browse files

Update Docs

Added README.rst AUTHORS and CONTRIBUTING guidelines
  • Loading branch information...
1 parent d01cfd1 commit 510679c3950f238a85f38c940f9d3557f50d07a1 @rozza rozza committed Dec 3, 2012
Showing with 1,352 additions and 692 deletions.
  1. +22 −0 AUTHORS
  2. +51 −0 CONTRIBUTING.rst
  3. +0 −55 README.md
  4. +74 −0 README.rst
  5. +3 −4 casbah-commons/src/main/scala/Logger.scala
  6. +20 −21 casbah-commons/src/main/scala/MongoDBObject.scala
  7. +10 −14 casbah-commons/src/main/scala/conversions/ScalaConversions.scala
  8. +9 −4 casbah-core/src/main/scala/Implicits.scala
  9. +306 −0 casbah-core/src/main/scala/MongoClient.scala
  10. +102 −0 casbah-core/src/main/scala/MongoClientOptions.scala
  11. +73 −0 casbah-core/src/main/scala/MongoClientURI.scala
  12. +113 −116 casbah-core/src/main/scala/MongoCollection.scala
  13. +55 −57 casbah-core/src/main/scala/MongoConnection.scala
  14. +140 −144 casbah-core/src/main/scala/MongoCursor.scala
  15. +40 −42 casbah-core/src/main/scala/MongoDB.scala
  16. +8 −10 casbah-core/src/main/scala/MongoOptions.scala
  17. +12 −14 casbah-core/src/main/scala/MongoURI.scala
  18. +1 −2 casbah-core/src/main/scala/ReadPreference.scala
  19. +6 −7 casbah-core/src/main/scala/WriteConcern.scala
  20. +6 −8 casbah-core/src/main/scala/map_reduce/MapReduceCommand.scala
  21. +5 −6 casbah-core/src/main/scala/map_reduce/MapReduceResult.scala
  22. +13 −15 casbah-core/src/test/scala/ConversionsSpec.scala
  23. +10 −10 casbah-core/src/test/scala/CoreWrappersSpec.scala
  24. +5 −4 casbah-core/src/test/scala/GroupSpec.scala
  25. +5 −9 casbah-core/src/test/scala/MapReduceSpec.scala
  26. +153 −0 casbah-core/src/test/scala/MongoClientSpec.scala
  27. +2 −3 casbah-core/src/test/scala/RawMapReduceSpec.scala
  28. +33 −34 casbah-gridfs/src/main/scala/GridFS.scala
  29. +27 −28 casbah-gridfs/src/main/scala/JodaGridFS.scala
  30. +3 −3 casbah-gridfs/src/test/scala/GridFSSpec.scala
  31. +18 −34 casbah-query/src/main/scala/BarewordOperators.scala
  32. +27 −48 casbah-query/src/main/scala/CoreOperators.scala
View
22 AUTHORS
@@ -0,0 +1,22 @@
+The PRIMARY AUTHORS are (and/or have been):
+
+Brendan W. McAdams
+Ross Lawley
+
+CONTRIBUTORS
+
+Dervived from the git logs, inevitably incomplete but all of whom and others
+have submitted patches, reported bugs and generally helped make Casbah
+that much better:
+
+* Novus Partners, Inc. <http://novus.com> Original sponsors of this casbah prior to Version 2.0
+* Max Afonov <max@bumnetworks.com>
+* Marcello Bastéa-Forte <marcello@cellosoft.com>
+* Philip Wills <otherphil@gmail.com>
+* Ben Gamari <bgamari@gmail.com>
+* Patrick Bohan <arkban@arkban.net>
+* Jon-Anders Teigen <@jteigen>
+* Bryan J Swift
+* Thibault Duplessis
+* Gerolf Seitz
+* Hitoshi Asai
View
@@ -0,0 +1,51 @@
+Contributing to Casbah
+======================
+
+Casbah has a growing `community
+<https://github.com/mongodb/casbah/blob/master/AUTHORS>`_ and
+contributions are always encouraged. Contributions can be as simple as
+minor tweaks to the documentation. Please read these guidelines before
+sending a pull request.
+
+Bugfixes and New Features
+-------------------------
+
+Before starting to write code, look for existing `tickets
+<https://jira.mongodb.org/browse/SCALA>`_ or `create one
+<https://jira.mongodb.org/browse/SCALA>`_ for your specific
+issue or feature request. That way you avoid working on something
+that might not be of interest or that has already been addressed.
+
+Supported Versions
+------------------
+
+Casbah currently supports Scala 2.9.X.
+
+Style Guide
+-----------
+
+Casbah aims to follow the
+`Scala style conventions <http://docs.scala-lang.org/style/>`_ including 2
+space indents and 79 character line limits.
+
+General Guidelines
+------------------
+
+- Avoid backward breaking changes if at all possible.
+- Write inline documentation for new classes and methods.
+- Write tests and make sure they pass (make sure you have a mongod
+ running on the default port, then execute ``./sbt test``
+ from the cmd line to run the test suite).
+- Add yourself to AUTHORS.rst :)
+
+Documentation
+-------------
+
+To contribute to the `API documentation <http://api.mongodb.org/scala/casbah/current/>`_
+just make your changes to the inline documentation of the appropriate
+`source code <https://github.com/mongodb/casbah>`_ or `rst file
+<https://github.com/mongodb/casbah/tree/master/tutorial_src>`_ in a
+branch and submit a `pull request <https://help.github.com/articles/using-pull-requests>`_.
+You might also use the github `Edit <https://github.com/blog/844-forking-with-the-edit-button>`_
+button.
+
View
@@ -1,55 +0,0 @@
-# Casbah
-## Scala toolkit for MongoDB (com.mongodb.casbah)
-
-Maintainers
------------
-Brendan W. McAdams <brendan@10gen.com>
-
-Contributors
------------
-* Max Afonov <max@bumnetworks.com>
-* Marcello Bastéa-Forte <marcello@cellosoft.com>
-* Philip Wills <otherphil@gmail.com>
-* Ben Gamari <bgamari@gmail.com>
-* Patrick Bohan <arkban@arkban.net>
-+ Jon-Anders Teigen <@jteigen>
-* Novus Partners, Inc. <http://novus.com>, who sponsored the development of this project prior to Version 2.0
-
-Reporting Bugs
---------------
-
-Please report all issues on the [MongoDB Jira Scala project][jira]
-
-We also maintain a [Casbah Mailing List][mongodb-casbah-users] on Google Groups, where you can address questions and problems.
-
-Notice for users of old, Pre-2.0 versions of Casbah
----------------------------------------------------
-
-The package has changed as of version 2.0 to `com.mongodb.casbah`; version 1.1 of Casbah used the package `com.novus.casbah` and versions 1.0 and below were packaged as `com.novus.casbah.mongodb`.
-
-In addition, we have broken the project out into several artifacts:
-
- * `casbah-commons` - Provides utilities to improve working with Scala and MongoDB together without dependencies on anything but the MongoDB Java Driver and ScalaJ-Collection. This includes Scala Collections 2.8 compatible wrappers for DBList and DBObject as well as type conversion facilities to simplify the use of Scala types with MongoDB (and register your own custom types)
- * `casbah-query` - The Query DSL which provides an internal Scala DSL for querying MongoDB using native, MongoDB syntax operators. This only depends upon Commons and can be used standalone without the rest of Casbah.
- * `casbah-core` - This is the wrappers for interacting directly with MongoDB providing more Scala-like interactions. It depends upon both Commons and Query as well as ScalaTime for use of JodaTime (which we prefer over JDK date but you are welcome to use JDK Dates).
- * `casbah-gridfs` - This provides enhancement wrappers to GridFS including loan pattern support. It is dependent on Core (and by transitive property, Commons & Query as well) but is not included in Core - you must explicitly load if it you want to use GridFS.
-
-About
------
-Casbah is an interface for [MongoDB][MongoDB] designed to provide more flexible access from both Java and Scala. While the current core focus is on providing a Scala oriented wrapper interface around the Java mongo driver, support for other JVM languages may come in the future.
-
-For the Scala side, contains series of wrappers and DSL-like functionality for utilizing MongoDB from within Scala. This currently utilises the very Java-oriented Mongo Java driver, and attempts to provide more scala-like functionality on top of it. This has been tested with MongoDB 1.2.x+ and v2.x of the Mongo java driver.
-
-We are constantly adding new functionality, and maintain a detailed [Tutorial][Tutorial].
-
-Please address any questions or problems to the [Casbah Mailing List][mongodb-casbah-users] on Google Groups.
-
-GitHub kindly hosts our [Documentation][Documentation] including the [API Docs][API Docs] & [Tutorial][Tutorial].
-
- [mongodb]: http://mongodb.org "MongoDB"
- [github]: http://github.com/mongodb/casbah "Casbah on GitHub"
- [api docs]: http://api.mongodb.org/scala/casbah/scaladoc/ "API Docs on GitHub"
- [documentation]: http://api.mongodb.org/scala/casbah/ "Docs on GitHub"
- [tutorial]: http://api.mongodb.org/scala/casbah/tutorial.html "Casbah Tutorial"
- [mongodb-casbah-users]: http://groups.google.com/group/mongodb-casbah-users "Casbah Mailing List"
- [jira]: http://jira.mongodb.org/browse/SCALA
View
@@ -0,0 +1,74 @@
+======
+Casbah
+======
+:Info: Scala toolkit for MongoDB (com.mongodb.casbah). See `the mongo site <http://www.mongodb.org>`_ for more information. See `github <http://github.com/mongodb/casbah/tree>`_ for the latest source.
+:Author: Brendan W. McAdams
+:Maintainer: Ross Lawley <ross@10gen.com>
+
+About
+=====
+Casbah is an interface for `MongoDB <http://www.mongodb.org>`_ designed to
+provide more flexible access from both Java and Scala. While the current core
+focus is on providing a Scala oriented wrapper interface around the Java mongo
+driver, support for other JVM languages may come in the future.
+
+For the Scala side, contains series of wrappers and DSL-like functionality for
+utilizing MongoDB from within Scala. This currently utilises the very
+Java-oriented Mongo Java driver, and attempts to provide more scala-like
+functionality on top of it. This has been tested with MongoDB 1.2.x+ and 2.x of
+the Mongo java driver.
+
+We are constantly adding new functionality, and maintain a detailed
+`Casbah Tutorial <http://api.mongodb.org/scala/casbah/tutorial.html>`_.
+
+Please address any questions or problems to the
+`Casbah Mailing List <http://groups.google.com/group/mongodb-casbah-users>`_ on
+Google Groups.
+
+For more information about Casbah see the
+`API Docs <http://api.mongodb.org/scala/casbah/scaladoc/>`_ or
+`Tutorial <http://api.mongodb.org/scala/casbah/tutorial.html>`_.
+
+Project Artifacts
+-----------------
+
+Casbah is separated out into several artifacts:
+
+* *casbah-commons*
+ Provides utilities to improve working with Scala and MongoDB together
+ without dependencies on anything but the MongoDB Java Driver and
+ ScalaJ-Collection. This includes Scala Collections 2.8 compatible
+ wrappers for DBList and DBObject as well as type conversion facilities to
+ simplify the use of Scala types with MongoDB (and register your own custom
+ types)
+* *casbah-query*
+ The Query DSL which provides an internal Scala DSL for querying MongoDB
+ using native, MongoDB syntax operators. This only depends upon Commons and
+ can be used standalone without the rest of Casbah.
+* *casbah-core*
+ This is the wrappers for interacting directly with MongoDB providing more
+ Scala-like interactions. It depends upon both Commons and Query as well as
+ ScalaTime for use of JodaTime (which we prefer over JDK date but you are
+ welcome to use JDK Dates).
+* *casbah-gridfs*
+ This provides enhancement wrappers to GridFS including loan pattern
+ support. It is dependent on Core (and by transitive property, Commons &
+ Query as well) but is not included in Core - you must explicitly load if it
+ you want to use GridFS.
+
+Contributing
+------------
+
+Please report all issues on the
+`MongoDB Jira Scala project <http://jira.mongodb.org/browse/SCALA>`_.
+
+We also maintain a
+`Casbah Mailing List <http://groups.google.com/group/mongodb-casbah-users>`_
+on Google Groups, where you can address questions and problems.
+
+Notice for users of old, Pre-2.0 versions of Casbah
+---------------------------------------------------
+
+The package has changed as of version 2.0 to `com.mongodb.casbah`; version 1.1
+of Casbah used the package `com.novus.casbah` and versions 1.0 and below were
+packaged as `com.novus.casbah.mongodb`.
@@ -1,11 +1,11 @@
/**
* Copyright (c) 2010 10gen, Inc. <http://10gen.com>
* Copyright (c) 2009, 2010 Novus Partners, Inc. <http://novus.com>
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@@ -17,7 +17,7 @@
* For questions and comments about this product, please see the project page at:
*
* http://github.com/mongodb/casbah
- *
+ *
*/
package com.mongodb.casbah
@@ -33,7 +33,6 @@ import java.net.UnknownHostException;
/**
* Base trait for all classes that wants to be able use the logging infrastructure.
*
- * @author <a href="http://jonasboner.com">Jonas Bon&#233;r</a>
*/
trait Logging {
@transient
@@ -1,11 +1,11 @@
/**
* Copyright (c) 2010 10gen, Inc. <http://10gen.com>
* Copyright (c) 2009, 2010 Novus Partners, Inc. <http://novus.com>
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@@ -17,7 +17,7 @@
* For questions and comments about this product, please see the project page at:
*
* http://github.com/mongodb/casbah
- *
+ *
*/
package com.mongodb.casbah
@@ -31,18 +31,17 @@ import scala.collection.generic._
import scala.collection.mutable.{Builder, Map, MapLike}
import scala.reflect._
-/**
+/**
* MapLike scala interface for Mongo DBObjects - proxies an existing DBObject.
* Cannot act as a DBObject or implement it's interface
* due to conflicts between the java methods and scala methods.
* Implicits and explicit methods allow you to convert to java though.
- *
+ *
* We will likely reimplement DBObject itself longterm as a pure base. on the wire format
- * @author Brendan W. McAdams <brendan@10gen.com>
* @since 1.0
- *
- * @tparam String
- * @tparam Object
+ *
+ * @tparam String
+ * @tparam Object
*/
@BeanInfo
class MongoDBObject(val underlying: DBObject = new BasicDBObject) extends Map[String, AnyRef]
@@ -52,18 +51,18 @@ class MongoDBObject(val underlying: DBObject = new BasicDBObject) extends Map[St
def iterator = underlying.toMap.iterator.asInstanceOf[Iterator[(String, Object)]]
- /**
+ /**
* as
*
* Works like apply(), unsafe, bare return of a value.
* Returns default if nothing matching is found, else
* tries to cast a value to the specified type.
- *
+ *
* Unless you overrode it, default throws
* a NoSuchElementException
- *
- * @param key (String)
- * @tparam A
+ *
+ * @param key (String)
+ * @tparam A
* @return (A)
* @throws NoSuchElementException
*/
@@ -172,11 +171,11 @@ class MongoDBObject(val underlying: DBObject = new BasicDBObject) extends Map[St
def partialObject = isPartialObject
override def put(k: String, v: AnyRef) = {
- val cvt = MongoDBObject.convertValue(v)
+ val cvt = MongoDBObject.convertValue(v)
cvt match {
- case _v: Option[_] =>
+ case _v: Option[_] =>
underlying.put(k, _v.orNull) match {
- case null => None
+ case null => None
case value => Some(value)
}
case _ =>
@@ -210,7 +209,7 @@ class MongoDBObject(val underlying: DBObject = new BasicDBObject) extends Map[St
object MongoDBObject {
- implicit val canBuildFrom: CanBuildFrom[Map[String, Any], (String, Any), DBObject] =
+ implicit val canBuildFrom: CanBuildFrom[Map[String, Any], (String, Any), DBObject] =
new CanBuildFrom[Map[String, Any], (String, Any), DBObject] {
def apply(from: Map[String, Any]) = apply()
def apply() = newBuilder[String, Any]
@@ -224,9 +223,9 @@ object MongoDBObject {
def newBuilder[A <: String, B <: Any]: Builder[(String, Any), DBObject] = new MongoDBObjectBuilder
protected[mongodb] def convertValue(v: Any): Any = v match {
- case x: MongoDBObject =>
+ case x: MongoDBObject =>
x.asDBObject
- case m: scala.collection.Map[String, _] =>
+ case m: scala.collection.Map[String, _] =>
// attempt to convert it to a DBObject
m.asDBObject
case _v: Option[_] =>
@@ -246,7 +245,7 @@ sealed class MongoDBObjectBuilder extends Builder[(String, Any), DBObject] {
protected var elems = empty
override def +=(x: (String, Any)) = {
- val cvt = MongoDBObject.convertValue(x._2)
+ val cvt = MongoDBObject.convertValue(x._2)
cvt match {
case _v: Option[_] => elems.add(x._1, _v.orNull)
case _ => elems.add(x._1, cvt)
Oops, something went wrong.

0 comments on commit 510679c

Please sign in to comment.