Uploaded image for project: 'C Driver'
  1. C Driver
  2. CDRIVER-4329

Do not permit extra fields when matching embedded documents in unified spec tests

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Unknown Unknown
    • None
    • Affects Version/s: None
    • Component/s: libmongoc, Testing
    • None

      This came up while investigating PHPLIB test failures in the let spec tests (see: DRIVERS-2270). We observed test failures in PHPLIB's test runner due to outgoing update commands including explicit false values for multi and upsert because spec tests did not use $$unsetOrMatches; however, the same spec tests raised no error in CDRIVER-4198, which suggested a libmongoc issue.

      test_check_event in runner.c calls entity_map_match for command and reply documents with allow_extra as true. It doesn't looked like bson_matcher_match in bson-match.c switches over to not allowing extra fields in embedded documents, and instead applies the incoming allow_extra field to all recursive calls. This conflicts with Allowing Extra Fields in Root-level Documents from the unified spec.

            Unassigned Unassigned
            jmikola@mongodb.com Jeremy Mikola
            0 Vote for this issue
            1 Start watching this issue