[JAVA-3432] ClassCastException in FindAndUpdateOperation Created: 12/Sep/19  Updated: 28/Oct/23  Resolved: 12/Sep/19

Status: Closed
Project: Java Driver
Component/s: Write Operations
Affects Version/s: 3.11.0
Fix Version/s: 3.11.1

Type: Bug Priority: Major - P3
Reporter: Christoph Strobl Assignee: Jeffrey Yemin
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

toBsonValueList casts Bson objects to BsonValue which errors when the actual value is eg. a Document.

MongoCollection<Document> collection = // ...
 
Document existing = collection.findOneAndUpdate(
    new Document("_id", 1), 
    Collections.singletonList(
        new Document("$set", new Document("title", "The Burning White"))
    ),
    new FindOneAndUpdateOptions().upsert(true));



 Comments   
Comment by Githook User [ 12/Sep/19 ]

Author:

{'username': 'jyemin', 'email': 'jeff.yemin@10gen.com', 'name': 'Jeff Yemin'}

Message: Accept any implementation of Bson interface for findAndUpdate pipeline

JAVA-3432
Branch: 3.11.x
https://github.com/mongodb/mongo-java-driver/commit/3ac00c408a0c4f654b5548462dd9cb78542e0ae4

Comment by Githook User [ 12/Sep/19 ]

Author:

{'username': 'jyemin', 'email': 'jeff.yemin@10gen.com', 'name': 'Jeff Yemin'}

Message: Accept any implementation of Bson interface for findAndUpdate pipeline

JAVA-3432
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/06b544159bdbb453261bb3aeed0dd688c79024ad

Generated at Thu Feb 08 08:59:35 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.