fakemongo / fongo

faked out in-memory mongo for java
Apache License 2.0
523 stars 156 forks source link

Not implemented for command : { "update" : "collectionName" , "ordered" : true} on updateMany #346

Open yahor-filipchyk opened 6 years ago

yahor-filipchyk commented 6 years ago

Fongo version: 2.2.0-RC2, Mongo Java driver version (used in tests for Fongo runtime): 3.6.3 Mongo Scala driver version (used by the app): 2.2.1

The persistence layer is using updateMany from the scala driver API, which results in a call to

com.mongodb.async.client.MongoCollection#updateMany(Bson filter, Bson update, SingleResultCallback<UpdateResult> callback)

in the Java async driver.

When running tests with Fongo, I'm getting the following exception:

com.github.fakemongo.FongoException: Not implemented for command : { "update" : "myCollection" , "ordered" : true}
    at com.github.fakemongo.FongoConnection.command(FongoConnection.java:747)
    at com.github.fakemongo.async.FongoAsyncConnection$15.call(FongoAsyncConnection.java:197)
    at com.github.fakemongo.async.FongoAsyncConnection.asyncResult(FongoAsyncConnection.java:257)
    at com.github.fakemongo.async.FongoAsyncConnection.commandAsync(FongoAsyncConnection.java:193)
    at com.mongodb.operation.MixedBulkWriteOperation.executeCommandAsync(MixedBulkWriteOperation.java:381)
    at com.mongodb.operation.MixedBulkWriteOperation.executeBatchesAsync(MixedBulkWriteOperation.java:313)
    at com.mongodb.operation.MixedBulkWriteOperation.access$900(MixedBulkWriteOperation.java:65)
    at com.mongodb.operation.MixedBulkWriteOperation$2$1.call(MixedBulkWriteOperation.java:232)
    at com.mongodb.operation.OperationHelper.validateWriteRequests(OperationHelper.java:175)
    at com.mongodb.operation.MixedBulkWriteOperation$2.call(MixedBulkWriteOperation.java:215)
    at com.mongodb.operation.OperationHelper$7.onResult(OperationHelper.java:526)
    at com.mongodb.operation.OperationHelper$7.onResult(OperationHelper.java:523)
    at com.github.fakemongo.async.FongoAsyncConnectionSource.getConnection(FongoAsyncConnectionSource.java:37)
    at com.mongodb.operation.OperationHelper.withConnectionSource(OperationHelper.java:523)
    at com.mongodb.operation.OperationHelper.access$100(OperationHelper.java:61)
    at com.mongodb.operation.OperationHelper$AsyncCallableWithConnectionAndSourceCallback.onResult(OperationHelper.java:543)
    at com.mongodb.operation.OperationHelper$AsyncCallableWithConnectionAndSourceCallback.onResult(OperationHelper.java:531)
    at com.mongodb.internal.async.ErrorHandlingResultCallback.onResult(ErrorHandlingResultCallback.java:49)
    at com.github.fakemongo.async.FongoAsync$2.getWriteConnectionSource(FongoAsync.java:220)
    at com.mongodb.operation.OperationHelper.withConnection(OperationHelper.java:482)
    at com.mongodb.operation.MixedBulkWriteOperation.executeAsync(MixedBulkWriteOperation.java:209)
    at com.github.fakemongo.async.FongoAsync.execute(FongoAsync.java:216)
    at com.mongodb.async.client.MongoCollectionImpl.executeSingleWriteRequest(MongoCollectionImpl.java:1114)
    at com.mongodb.async.client.MongoCollectionImpl.executeUpdate(MongoCollectionImpl.java:734)
    at com.mongodb.async.client.MongoCollectionImpl.updateMany(MongoCollectionImpl.java:716)
    at com.mongodb.async.client.MongoCollectionImpl.updateMany(MongoCollectionImpl.java:710)
    at org.mongodb.scala.MongoCollection.$anonfun$updateMany$1(MongoCollection.scala:721)
    at org.mongodb.scala.MongoCollection.$anonfun$updateMany$1$adapted(MongoCollection.scala:721)
    at org.mongodb.scala.internal.ObservableHelper$$anon$1.apply(ObservableHelper.scala:36)
    at org.mongodb.scala.internal.ObservableHelper$$anon$1.apply(ObservableHelper.scala:35)
    at com.mongodb.async.client.SingleResultCallbackSubscription.requestInitialData(SingleResultCallbackSubscription.java:38)
    at com.mongodb.async.client.AbstractSubscription.tryRequestInitialData(AbstractSubscription.java:151)
    at com.mongodb.async.client.AbstractSubscription.request(AbstractSubscription.java:82)
    at org.mongodb.scala.ObservableImplicits$BoxedSubscription.request(ObservableImplicits.scala:474)
    at org.mongodb.scala.ObservableImplicits$ScalaObservable$$anon$2.onSubscribe(ObservableImplicits.scala:373)
    at org.mongodb.scala.ObservableImplicits$ToSingleObservable$$anon$3.onSubscribe(ObservableImplicits.scala:440)
    at org.mongodb.scala.Observer.onSubscribe(Observer.scala:85)
    at org.mongodb.scala.Observer.onSubscribe$(Observer.scala:85)
    at org.mongodb.scala.ObservableImplicits$ToSingleObservable$$anon$3.onSubscribe(ObservableImplicits.scala:432)
    at com.mongodb.async.client.SingleResultCallbackSubscription.<init>(SingleResultCallbackSubscription.java:33)
    at com.mongodb.async.client.Observables$2.subscribe(Observables.java:76)
    at org.mongodb.scala.ObservableImplicits$BoxedObservable.subscribe(ObservableImplicits.scala:458)
    at org.mongodb.scala.ObservableImplicits$ToSingleObservable.subscribe(ObservableImplicits.scala:432)
    at org.mongodb.scala.ObservableImplicits$ScalaObservable.headOption(ObservableImplicits.scala:365)
    at org.mongodb.scala.ObservableImplicits$ScalaObservable.head(ObservableImplicits.scala:351)
    at org.mongodb.scala.ObservableImplicits$ScalaSingleObservable.toFuture(ObservableImplicits.scala:410)
    at my.company.mongo.BaseDAO.$anonfun$updateMany$1(BaseDAO.scala:67)

Matching Fongo source is a bit concerning https://github.com/fakemongo/fongo/blob/driver36/src/main/java/com/github/fakemongo/FongoConnection.java#L748-L798 Does this mean updates are not supported or something else?