-
Type: Improvement
-
Resolution: Unresolved
-
Priority: Minor - P4
-
None
-
Affects Version/s: None
-
Component/s: Unified Test Runner
-
None
-
Java Drivers
The specification https://github.com/mongodb/specifications/blob/master/source/unified-test-format/unified-test-format.md#allowing-extra-fields-in-root-level-documents requires us to permit extra fields in root-level documents (though, it does not specify what those documents are). Our com.mongodb.client.unified.ValueMatcher.assertValuesMatch ignores extra fields in all documents regardless of the nesting level. As a result, the following expectation matches always
"expectError": { "expectResult": { "$$unsetOrMatches": {} } }
and the next one matches any insertResults, updateResults, deleteResults
"expectError": { "expectResult": { "insertedCount": 1, "upsertedCount": 0, "matchedCount": 0, "modifiedCount": 0, "deletedCount": 0, "insertResults": { "$$unsetOrMatches": {} }, "updateResults": { "$$unsetOrMatches": {} }, "deleteResults": { "$$unsetOrMatches": {} } } }
This issue was discovered when reviewing https://github.com/mongodb/specifications/pull/1665.
Note that if we start checking that the actual document does not have any extra fields compared to the expected documents, we can't do that by simply comparing the number of fields. For example, the following field in the expected document requires its key to not be present in the actual document:
"thisKeyMustNotBePresentInTheActualDocument": { "$$exists": false }
- related to
-
DRIVERS-3013 List all root-level document contexts and clarify when an expected array is an array of root-level documents
- Closed