mongo-java-server icon indicating copy to clipboard operation
mongo-java-server copied to clipboard

Is bulkwrite with aggregation pipeline supported ?

Open weswes opened this issue 2 years ago • 1 comments

It seems not supported as I get this error:

´´´ com.mongodb.MongoCommandException: Command failed with error -1: 'Unknown error: class java.util.ArrayList cannot be cast to class de.bwaldvogel.mongo.bson.Document (java.util.ArrayList is in module java.base of loader 'bootstrap'; de.bwaldvogel.mongo.bson.Document is in unnamed module of loader 'app')' on server 127.0.0.1:57611. The full response is {"$err": "Unknown error: class java.util.ArrayList cannot be cast to class de.bwaldvogel.mongo.bson.Document (java.util.ArrayList is in module java.base of loader 'bootstrap'; de.bwaldvogel.mongo.bson.Document is in unnamed module of loader 'app')", "errmsg": "Unknown error: class java.util.ArrayList cannot be cast to class de.bwaldvogel.mongo.bson.Document (java.util.ArrayList is in module java.base of loader 'bootstrap'; de.bwaldvogel.mongo.bson.Document is in unnamed module of loader 'app')", "ok": 0} ´´´

weswes avatar Oct 11 '23 11:10 weswes

I just ran into this myself trying to use an aggregation pipeline with an updateMany. The problem starts here https://github.com/bwaldvogel/mongo-java-server/blob/03b38aaeab892db986ef61084ada7ea581ca7300/core/src/main/java/de/bwaldvogel/mongo/backend/AbstractMongoDatabase.java#L319

According to the MongoDB update command reference, in 4.2 this was changed to support either a document or a pipeline, but mongo-java-server only supports a single document.

tresni avatar Mar 09 '24 06:03 tresni