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

Commit

Permalink
SCALA-70: Removed type alias to com.mongodb.WriteConcern and made met…
Browse files Browse the repository at this point in the history
…hod args for it explicit, as it was causing a fun post-compile (aka "library compiles, user code doesn't") implosion.
  • Loading branch information
Brendan W. McAdams committed Feb 1, 2012
1 parent d768bc3 commit 356600e
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 49 deletions.
1 change: 0 additions & 1 deletion casbah-core/src/main/scala/Implicits.scala
Expand Up @@ -152,7 +152,6 @@ trait BaseImports {

trait TypeImports {
type MongoOptions = com.mongodb.MongoOptions
type WriteConcern = com.mongodb.WriteConcern
type LazyDBObject = com.mongodb.LazyDBObject
type ReadPreference = com.mongodb.ReadPreference
type WriteResult = com.mongodb.WriteResult
Expand Down
40 changes: 20 additions & 20 deletions casbah-core/src/main/scala/MongoCollection.scala
Expand Up @@ -306,7 +306,7 @@ abstract class MongoCollection extends Logging with Iterable[DBObject] {
*
* @throws MongoException
*/
@deprecated("Pass WriteConcern to write ops instead for single op safety.")
@deprecated("Pass com.mongodb.WriteConcern to write ops instead for single op safety.")
def request(op: this.type => WriteResult) = {
op(this).getLastError.throwOnError
}
Expand All @@ -327,7 +327,7 @@ abstract class MongoCollection extends Logging with Iterable[DBObject] {
*
* @throws MongoException
*/
@deprecated("Pass WriteConcern to write ops instead for single op safety.")
@deprecated("Pass com.mongodb.WriteConcern to write ops instead for single op safety.")
def request(w: Int, wTimeout: Int = 0, fsync: Boolean = false)(op: this.type => WriteResult) =
op(this).getLastError(WriteConcern(w, wTimeout, fsync)).throwOnError

Expand All @@ -347,8 +347,8 @@ abstract class MongoCollection extends Logging with Iterable[DBObject] {
*
* @throws MongoException
*/
@deprecated("Pass WriteConcern to write ops instead for single op safety.")
def request(concern: WriteConcern)(op: this.type => WriteResult) =
@deprecated("Pass com.mongodb.WriteConcern to write ops instead for single op safety.")
def request(concern: com.mongodb.WriteConcern)(op: this.type => WriteResult) =
op(this).getLastError(concern).throwOnError

/** Find a collection that is prefixed with this collection's name.
Expand Down Expand Up @@ -483,7 +483,7 @@ abstract class MongoCollection extends Logging with Iterable[DBObject] {
* @dochub insert
* TODO - Wrapper for WriteResult?
*/
def insert[A](docs: A*)(implicit dbObjView: A => DBObject, concern: WriteConcern = writeConcern, encoder: DBEncoder = customEncoderFactory.map(_.create).orNull ): WriteResult = {
def insert[A](docs: A*)(implicit dbObjView: A => DBObject, concern: com.mongodb.WriteConcern = writeConcern, encoder: DBEncoder = customEncoderFactory.map(_.create).orNull ): WriteResult = {
val b = new scala.collection.mutable.ArrayBuilder.ofRef[DBObject]
b.sizeHint(docs.size)
for (x <- docs) b += dbObjView(x)
Expand Down Expand Up @@ -522,7 +522,7 @@ abstract class MongoCollection extends Logging with Iterable[DBObject] {
* @dochub remove
* TODO - Wrapper for WriteResult?
*/
def remove[A](o: A)(implicit dbObjView: A => DBObject, concern: WriteConcern = getWriteConcern, encoder: DBEncoder = customEncoderFactory.map(_.create).orNull ) =
def remove[A](o: A)(implicit dbObjView: A => DBObject, concern: com.mongodb.WriteConcern = getWriteConcern, encoder: DBEncoder = customEncoderFactory.map(_.create).orNull ) =
underlying.remove(dbObjView(o), concern, encoder)

/** Clears all indices that have not yet been applied to this collection. */
Expand All @@ -533,7 +533,7 @@ abstract class MongoCollection extends Logging with Iterable[DBObject] {
* will add <code>_id</code> field to o if needed
* TODO - Wrapper for WriteResult?
*/
def save[A](o: A)(implicit dbObjView: A => DBObject, concern: WriteConcern = writeConcern) = underlying.save(dbObjView(o), writeConcern)
def save[A](o: A)(implicit dbObjView: A => DBObject, concern: com.mongodb.WriteConcern = writeConcern) = underlying.save(dbObjView(o), writeConcern)


/** Set hint fields for this collection.
Expand Down Expand Up @@ -566,7 +566,7 @@ abstract class MongoCollection extends Logging with Iterable[DBObject] {
* @dochub update
* TODO - Wrapper for WriteResult?
*/
def update[A, B](q: A, o: B, upsert: Boolean = false, multi: Boolean = false)(implicit queryView: A => DBObject, objView: B => DBObject, concern: WriteConcern = this.writeConcern, encoder: DBEncoder = customEncoderFactory.map(_.create).orNull ) =
def update[A, B](q: A, o: B, upsert: Boolean = false, multi: Boolean = false)(implicit queryView: A => DBObject, objView: B => DBObject, concern: com.mongodb.WriteConcern = this.writeConcern, encoder: DBEncoder = customEncoderFactory.map(_.create).orNull ) =
underlying.update(queryView(q), objView(o), upsert, multi, concern, encoder)


Expand Down Expand Up @@ -611,9 +611,9 @@ abstract class MongoCollection extends Logging with Iterable[DBObject] {
*/
def getLastError() = getDB.getLastError
def lastError() = getLastError()
def getLastError(concern: WriteConcern) =
def getLastError(concern: com.mongodb.WriteConcern) =
getDB.getLastError(concern)
def lastError(concern: WriteConcern) =
def lastError(concern: com.mongodb.WriteConcern) =
getLastError(concern)
def getLastError(w: Int, wTimeout: Int, fsync: Boolean) =
getDB.getLastError(w, wTimeout, fsync)
Expand All @@ -638,33 +638,33 @@ abstract class MongoCollection extends Logging with Iterable[DBObject] {
*
* Set the write concern for this database.
* Will be used for writes to any collection in this database.
* See the documentation for {@link WriteConcern} for more info.
* See the documentation for {@link com.mongodb.WriteConcern} for more info.
*
* @param concern (WriteConcern) The write concern to use
* @see WriteConcern
* @param concern (com.mongodb.WriteConcern) The write concern to use
* @see com.mongodb.WriteConcern
* @see http://www.thebuzzmedia.com/mongodb-single-server-data-durability-guide/
*/
def setWriteConcern(concern: WriteConcern) = underlying.setWriteConcern(concern)
def setWriteConcern(concern: com.mongodb.WriteConcern) = underlying.setWriteConcern(concern)

/**
*
* Set the write concern for this database.
* Will be used for writes to any collection in this database.
* See the documentation for {@link WriteConcern} for more info.
* See the documentation for {@link com.mongodb.WriteConcern} for more info.
*
* @param concern (WriteConcern) The write concern to use
* @see WriteConcern
* @see http://www.thebuzzmedia.com/mongodb-single-server-data-durability-guide/
*/
def writeConcern_=(concern: WriteConcern) = setWriteConcern(concern)
def writeConcern_=(concern: com.mongodb.WriteConcern) = setWriteConcern(concern)

/**
*
* get the write concern for this database,
* which is used for writes to any collection in this database.
* See the documentation for {@link WriteConcern} for more info.
* See the documentation for {@link com.mongodb.WriteConcern} for more info.
*
* @see WriteConcern
* @see com.mongodb.WriteConcern
* @see http://www.thebuzzmedia.com/mongodb-single-server-data-durability-guide/
*/
def getWriteConcern = underlying.getWriteConcern()
Expand All @@ -673,9 +673,9 @@ abstract class MongoCollection extends Logging with Iterable[DBObject] {
*
* get the write concern for this database,
* which is used for writes to any collection in this database.
* See the documentation for {@link WriteConcern} for more info.
* See the documentation for {@link com.mongodb.WriteConcern} for more info.
*
* @see WriteConcern
* @see com.mongodb.WriteConcern
* @see http://www.thebuzzmedia.com/mongodb-single-server-data-durability-guide/
*/
def writeConcern = getWriteConcern
Expand Down
22 changes: 11 additions & 11 deletions casbah-core/src/main/scala/MongoConnection.scala
Expand Up @@ -266,31 +266,31 @@ class MongoConnection(val underlying: com.mongodb.Mongo) {
* Will be used for writes to any collection in this database.
* See the documentation for {@link WriteConcern} for more info.
*
* @param concern (WriteConcern) The write concern to use
* @see WriteConcern
* @param concern (com.mongodb.WriteConcern) The write concern to use
* @see com.mongodb.WriteConcern
* @see http://www.thebuzzmedia.com/mongodb-single-server-data-durability-guide/
*/
def setWriteConcern(concern: WriteConcern) = underlying.setWriteConcern(concern)
def setWriteConcern(concern: com.mongodb.WriteConcern) = underlying.setWriteConcern(concern)

/**
*
* Set the write concern for this database.
* Will be used for writes to any collection in this database.
* See the documentation for {@link WriteConcern} for more info.
* See the documentation for {@link com.mongodb.WriteConcern} for more info.
*
* @param concern (WriteConcern) The write concern to use
* @see WriteConcern
* @param concern (com.mongodb.WriteConcern) The write concern to use
* @see com.mongodb.WriteConcern
* @see http://www.thebuzzmedia.com/mongodb-single-server-data-durability-guide/
*/
def writeConcern_=(concern: WriteConcern) = setWriteConcern(concern)
def writeConcern_=(concern: com.mongodb.WriteConcern) = setWriteConcern(concern)

/**
*
* get the write concern for this database,
* which is used for writes to any collection in this database.
* See the documentation for {@link WriteConcern} for more info.
* See the documentation for {@link com.mongodb.WriteConcern} for more info.
*
* @see WriteConcern
* @see com.mongodb.WriteConcern
* @see http://www.thebuzzmedia.com/mongodb-single-server-data-durability-guide/
*/
def getWriteConcern = underlying.getWriteConcern
Expand All @@ -299,9 +299,9 @@ class MongoConnection(val underlying: com.mongodb.Mongo) {
*
* get the write concern for this database,
* which is used for writes to any collection in this database.
* See the documentation for {@link WriteConcern} for more info.
* See the documentation for {@link com.mongodb.WriteConcern} for more info.
*
* @see WriteConcern
* @see com.mongodb.WriteConcern
* @see http://www.thebuzzmedia.com/mongodb-single-server-data-durability-guide/
*/
def writeConcern = getWriteConcern
Expand Down
32 changes: 16 additions & 16 deletions casbah-core/src/main/scala/MongoDB.scala
Expand Up @@ -151,9 +151,9 @@ class MongoDB(val underlying: com.mongodb.DB) {
*/
def getLastError() = underlying.getLastError
def lastError() = getLastError()
def getLastError(writeConcern: WriteConcern) =
def getLastError(writeConcern: com.mongodb.WriteConcern) =
underlying.getLastError(writeConcern)
def lastError(writeConcern: WriteConcern) =
def lastError(writeConcern: com.mongodb.WriteConcern) =
getLastError(writeConcern)
def getLastError(w: Int, wTimeout: Int, fsync: Boolean) =
underlying.getLastError(w, wTimeout, fsync)
Expand Down Expand Up @@ -230,33 +230,33 @@ class MongoDB(val underlying: com.mongodb.DB) {
*
* Set the write concern for this database.
* Will be used for writes to any collection in this database.
* See the documentation for {@link WriteConcern} for more info.
* See the documentation for {@link com.mongodb.WriteConcern} for more info.
*
* @param concern (WriteConcern) The write concern to use
* @see WriteConcern
* @param concern (com.mongodb.WriteConcern) The write concern to use
* @see com.mongodb.WriteConcern
* @see http://www.thebuzzmedia.com/mongodb-single-server-data-durability-guide/
*/
def setWriteConcern(concern: WriteConcern) = underlying.setWriteConcern(concern)
def setWriteConcern(concern: com.mongodb.WriteConcern) = underlying.setWriteConcern(concern)

/**
*
* Set the write concern for this database.
* Will be used for writes to any collection in this database.
* See the documentation for {@link WriteConcern} for more info.
* See the documentation for {@link com.mongodb.WriteConcern} for more info.
*
* @param concern (WriteConcern) The write concern to use
* @see WriteConcern
* @param concern (com.mongodb.WriteConcern) The write concern to use
* @see com.mongodb.WriteConcern
* @see http://www.thebuzzmedia.com/mongodb-single-server-data-durability-guide/
*/
def writeConcern_=(concern: WriteConcern) = setWriteConcern(concern)
def writeConcern_=(concern: com.mongodb.WriteConcern) = setWriteConcern(concern)

/**
*
* get the write concern for this database,
* which is used for writes to any collection in this database.
* See the documentation for {@link WriteConcern} for more info.
* See the documentation for {@link com.mongodb.WriteConcern} for more info.
*
* @see WriteConcern
* @see com.mongodb.WriteConcern
* @see http://www.thebuzzmedia.com/mongodb-single-server-data-durability-guide/
*/
def getWriteConcern = underlying.getWriteConcern()
Expand All @@ -265,9 +265,9 @@ class MongoDB(val underlying: com.mongodb.DB) {
*
* get the write concern for this database,
* which is used for writes to any collection in this database.
* See the documentation for {@link WriteConcern} for more info.
* See the documentation for {@link com.mongodb.WriteConcern} for more info.
*
* @see WriteConcern
* @see com.mongodb.WriteConcern
* @see http://www.thebuzzmedia.com/mongodb-single-server-data-durability-guide/
*/
def writeConcern = getWriteConcern
Expand Down Expand Up @@ -342,7 +342,7 @@ class MongoDB(val underlying: com.mongodb.DB) {
* Your function must return WriteResult, which is the
* return type of any mongo write operation like insert/save/update/remove
*
* If you have set a connection or DB level WriteConcern,
* If you have set a connection or DB level com.mongodb.WriteConcern,
* it will be inherited.
*
* @throws MongoException
Expand Down Expand Up @@ -385,7 +385,7 @@ class MongoDB(val underlying: com.mongodb.DB) {
*
* @throws MongoException
*/
def request(writeConcern: WriteConcern)(op: MongoDB => WriteResult) =
def request(writeConcern: com.mongodb.WriteConcern)(op: MongoDB => WriteResult) =
op(this).getLastError(writeConcern).throwOnError

def checkedWrite(op: MongoDB => WriteResult) =
Expand Down
2 changes: 1 addition & 1 deletion project/CasbahBuild.scala
Expand Up @@ -6,7 +6,7 @@ object CasbahBuild extends Build {
import Resolvers._

lazy val buildSettings = Seq(
organization := "com.mongodb.casbah",
organization := "org.mongodb",
version := "3.0.0-M1",
crossScalaVersions := Seq("2.9.1", "2.9.0-1", "2.9.0", "2.8.1")
)
Expand Down

0 comments on commit 356600e

Please sign in to comment.