Skip to content

Commit e4eb1eb

Browse files
committed
Updated Mongodb Driver Async dependency to 3.5.0
1 parent e89f3b7 commit e4eb1eb

File tree

9 files changed

+121
-11
lines changed

9 files changed

+121
-11
lines changed

bson/src/main/scala/org/mongodb/scala/bson/codecs/macrocodecs/MacroCodec.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import scala.collection.mutable
2121

2222
import org.bson.codecs.configuration.{ CodecConfigurationException, CodecRegistries, CodecRegistry }
2323
import org.bson.codecs.{ Codec, DecoderContext, Encoder, EncoderContext }
24-
import org.bson.{ BsonReader, BsonType, BsonValue, BsonWriter }
24+
import org.bson._
2525

2626
import org.mongodb.scala.bson.BsonNull
2727

@@ -124,10 +124,10 @@ trait MacroCodec[T] extends Codec[T] {
124124
}
125125
}
126126

127-
reader.mark()
127+
val mark: BsonReaderMark = reader.getMark()
128128
reader.readStartDocument()
129129
val optionalClassName: Option[String] = readOptionalClassName()
130-
reader.reset()
130+
mark.reset()
131131

132132
val className = optionalClassName.getOrElse {
133133
throw new CodecConfigurationException(s"Could not decode sealed case class. Missing '$classFieldName' field.")

docs/reference/content/changelog.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ title = "Changelog"
1111
Changes between released versions
1212

1313
### 2.2.0
14-
14+
15+
* Updated Mongodb Driver Async dependency to [3.5.0](https://jira.mongodb.org/browse/SCALA-335)
1516
* CaseClassCodec - Added support for internal vals. [SCALA-314](https://jira.mongodb.org/browse/SCALA-314)
1617
* CaseClassCodec - Added support for default values. [SCALA-313](https://jira.mongodb.org/browse/SCALA-313)
1718
* CaseClassCodec - Added handling of extra values in the document. [SCALA-307](https://jira.mongodb.org/browse/SCALA-307)

driver/src/it/scala/org/mongodb/scala/RequiresMongoDBISpec.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ trait RequiresMongoDBISpec extends FlatSpec with Matchers with ScalaFutures with
121121
def serverVersionAtLeast(minServerVersion: List[Int]): Boolean = {
122122
buildInfo.get[BsonString]("version") match {
123123
case Some(version) =>
124-
val serverVersion = version.getValue.split("\\.").map(_.toInt).padTo(3, 0).take(3).toList.asJava
124+
val serverVersion = version.getValue.split("\\D+").map(_.toInt).padTo(3, 0).take(3).toList.asJava
125125
new ServerVersion(serverVersion.asInstanceOf[java.util.List[Integer]]).compareTo(
126126
new ServerVersion(minServerVersion.asJava.asInstanceOf[java.util.List[Integer]])) > 0
127127
case None => false
@@ -131,7 +131,7 @@ trait RequiresMongoDBISpec extends FlatSpec with Matchers with ScalaFutures with
131131
def serverVersionLessThan(maxServerVersion: List[Int]): Boolean = {
132132
buildInfo.get[BsonString]("version") match {
133133
case Some(version) =>
134-
val serverVersion = version.getValue.split("\\.").map(_.toInt).padTo(3, 0).take(3).toList.asJava
134+
val serverVersion = version.getValue.split("\\D+").map(_.toInt).padTo(3, 0).take(3).toList.asJava
135135
new ServerVersion(serverVersion.asInstanceOf[java.util.List[Integer]]).compareTo(
136136
new ServerVersion(maxServerVersion.asJava.asInstanceOf[java.util.List[Integer]])) < 0
137137
case None => false

driver/src/main/scala/org/mongodb/scala/AggregateObservable.scala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,14 @@ case class AggregateObservable[TResult](private val wrapped: AggregateIterable[T
6464
* Sets whether the server should use a cursor to return results.
6565
*
6666
* [[http://docs.mongodb.org/manual/reference/command/aggregate/ Aggregation]]
67+
*
6768
* @param useCursor whether the server should use a cursor to return results
6869
* @return this
70+
* @deprecated There is no replacement for this. Applications can assume that the driver will use a cursor for server versions
71+
* that support it (&gt;= 2.6). The driver will ignore this as of MongoDB 3.6, which does not support inline results for
72+
* the aggregate command.
6973
*/
74+
@Deprecated
7075
def useCursor(useCursor: Boolean): AggregateObservable[TResult] = {
7176
wrapped.useCursor(useCursor)
7277
this

driver/src/main/scala/org/mongodb/scala/FindObservable.scala

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,12 @@ case class FindObservable[TResult](private val wrapped: FindIterable[TResult]) e
119119
* Sets the query modifiers to apply to this operation.
120120
*
121121
* [[http://docs.mongodb.org/manual/reference/operator/query-modifier/ Query Modifiers]]
122+
*
122123
* @param modifiers the query modifiers to apply, which may be null.
123124
* @return this
125+
* @deprecated use the individual setters instead
124126
*/
127+
@Deprecated
125128
def modifiers(modifiers: Bson): FindObservable[TResult] = {
126129
wrapped.modifiers(modifiers)
127130
this
@@ -210,5 +213,105 @@ case class FindObservable[TResult](private val wrapped: FindIterable[TResult]) e
210213
this
211214
}
212215

216+
/**
217+
* Sets the comment to the query. A null value means no comment is set.
218+
*
219+
* @param comment the comment
220+
* @return this
221+
* @since 2.2
222+
*/
223+
def comment(comment: String): FindObservable[TResult] = {
224+
wrapped.comment(comment)
225+
this
226+
}
227+
228+
/**
229+
* Sets the hint for which index to use. A null value means no hint is set.
230+
*
231+
* @param hint the hint
232+
* @return this
233+
* @since 2.2
234+
*/
235+
def hint(hint: Bson): FindObservable[TResult] = {
236+
wrapped.hint(hint)
237+
this
238+
}
239+
240+
/**
241+
* Sets the exclusive upper bound for a specific index. A null value means no max is set.
242+
*
243+
* @param max the max
244+
* @return this
245+
* @since 2.2
246+
*/
247+
def max(max: Bson): FindObservable[TResult] = {
248+
wrapped.max(max)
249+
this
250+
}
251+
252+
/**
253+
* Sets the minimum inclusive lower bound for a specific index. A null value means no max is set.
254+
*
255+
* @param min the min
256+
* @return this
257+
* @since 2.2
258+
*/
259+
def min(min: Bson): FindObservable[TResult] = {
260+
wrapped.min(min)
261+
this
262+
}
263+
264+
/**
265+
* Sets the maximum number of documents or index keys to scan when executing the query.
266+
*
267+
* A zero value or less will be ignored, and indicates that the driver should respect the server's default value.
268+
*
269+
* @param maxScan the maxScan
270+
* @return this
271+
* @since 2.2
272+
*/
273+
def maxScan(maxScan: Long): FindObservable[TResult] = {
274+
wrapped.maxScan(maxScan)
275+
this
276+
}
277+
278+
/**
279+
* Sets the returnKey. If true the find operation will return only the index keys in the resulting documents.
280+
*
281+
* @param returnKey the returnKey
282+
* @return this
283+
* @since 2.2
284+
*/
285+
def returnKey(returnKey: Boolean): FindObservable[TResult] = {
286+
wrapped.returnKey(returnKey)
287+
this
288+
}
289+
290+
/**
291+
* Sets the showRecordId. Set to true to add a field `$recordId` to the returned documents.
292+
*
293+
* @param showRecordId the showRecordId
294+
* @return this
295+
* @since 2.2
296+
*/
297+
def showRecordId(showRecordId: Boolean): FindObservable[TResult] = {
298+
wrapped.showRecordId(showRecordId)
299+
this
300+
}
301+
302+
/**
303+
* Sets the snapshot.
304+
*
305+
* If true it prevents the cursor from returning a document more than once because of an intervening write operation.
306+
*
307+
* @param snapshot the snapshot
308+
* @return this
309+
* @since 2.2
310+
*/
311+
def snapshot(snapshot: Boolean): FindObservable[TResult] = {
312+
wrapped.snapshot(snapshot)
313+
this
314+
}
315+
213316
override def subscribe(observer: Observer[_ >: TResult]): Unit = observe(wrapped).subscribe(observer)
214317
}

driver/src/test/scala/org/mongodb/scala/ApiAliasAndCompanionSpec.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ class ApiAliasAndCompanionSpec extends FlatSpec with Matchers {
3434
"The scala package" should "mirror the com.mongodb package and com.mongodb.async.client" in {
3535
val packageName = "com.mongodb"
3636
val javaExclusions = Set("AsyncBatchCursor", "Block", "ConnectionString", "Function", "ServerCursor", "Majority", "MongoClients",
37-
"MongoIterable", "Observables", "SingleResultCallback", "GridFSBuckets")
37+
"MongoIterable", "Observables", "SingleResultCallback", "GridFSBuckets", "DBRefCodec", "DBRefCodecProvider", "DBRef",
38+
"DocumentToDBRefTransformer")
3839
val scalaExclusions = Set("package", "internal", "result", "Helpers", "Document", "BulkWriteResult", "ScalaObservable",
3940
"ScalaWriteConcern", "ObservableImplicits", "Completed", "BoxedObservable", "BoxedObserver", "BoxedSubscription",
4041
"classTagToClassOf", "ReadConcernLevel", "bsonDocumentToDocument", "bsonDocumentToUntypedDocument", "documentToUntypedDocument",

driver/src/test/scala/org/mongodb/scala/model/FiltersSpec.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,9 +189,9 @@ class FiltersSpec extends FlatSpec with Matchers {
189189
}
190190

191191
it should "render $regex" in {
192-
toBson(model.Filters.regex("name", "acme.*corp")) should equal(Document("""{name : {$regex : "acme.*corp"}}"""))
192+
toBson(model.Filters.regex("name", "acme.*corp")) should equal(Document("""{name : {$regex : "acme.*corp", $options : ""}}"""))
193193
toBson(model.Filters.regex("name", "acme.*corp", "si")) should equal(Document("""{name : {$regex : "acme.*corp", $options : "si"}}"""))
194-
toBson(model.Filters.regex("name", "acme.*corp".r)) should equal(Document("""{name : {$regex : "acme.*corp"}}"""))
194+
toBson(model.Filters.regex("name", "acme.*corp".r)) should equal(Document("""{name : {$regex : "acme.*corp", $options : ""}}"""))
195195
}
196196

197197
it should "render $where" in {

project/Dependencies.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ object Dependencies {
2121
// Versions
2222
val scalaVersions = Seq("2.11.11", "2.12.2")
2323
val scalaCoreVersion = "2.12.2"
24-
val mongodbDriverVersion = "3.4.2"
24+
val mongodbDriverVersion = "3.5.0"
2525

2626
val scalaTestVersion = "3.0.1"
2727
val scalaMockVersion = "3.4.1"

project/MongoScalaBuild.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ object MongoScalaBuild extends Build {
5252
def scalacOptionsVersion(scalaVersion: String): Seq[String] = {
5353
Seq( "-unchecked", "-deprecation", "-feature", "-Ywarn-dead-code"
5454
/*,"-Xfatal-warnings", "-Ymacro-debug-verbose", "-Xlog-implicits", "-Yinfer-debug", "-Xprint:typer"*/) ++ (scalaVersion match {
55-
case "2.12.2" => Seq("-Xlint:-unused,-missing-interpolator,_", "-Ywarn-unused:imports,privates,locals,-implicits,-params")
55+
case "2.12.2" => Seq("-Xlint:-unused,-missing-interpolator,_" /*, "-Ywarn-unused:imports,privates,locals,-implicits,-params"*/)
5656
case _ => Seq("-language:existentials", "-Xlint:-missing-interpolator,_")
5757
})
5858
}

0 commit comments

Comments
 (0)