Details
-
Bug
-
Resolution: Gone away
-
Minor - P4
-
None
-
None
-
None
-
None
Description
Summary
When running MongoCollection#listCollections, the iterator fails with a ClassCastException in DocumentToDBRefTransformer.
Please provide the version of the driver. If applicable, please provide the MongoDB server version and topology (standalone, replica set, or sharded cluster).
Mongo Java Driver: 4.7.0
MongoDB Atlas: 4.4.26
How to Reproduce
- Create a collection that uses DBRef
- Run MongoClient#getDatabase#listCollections
Additional Background
This issue only occurs when DBRef is used in the database. It failed trying to transform a Document to a DBRef, expecting the fields $ref and $db to be Strings, but instead they were Documents. The Document that failed to transform is as follows:
{
$ref: {type: "string", description: "$ref must be a string and is required"},
$id: {bsonType: "objectId", description: "$id must be an objectId and is required"},
$db: {type: "string", description: "$db must be a string and is required"}
}