InvalidDocument clause does not include _id encoding

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Unknown
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Python Drivers
    • None
    • None
    • None
    • None
    • None
    • None

      Context

      Our _dict_to_bson bson method contains this code block:

              for key, value in doc.items():
                  if not top_level or key != "_id":
                      try:
                          elements.append(_element_to_bson(key, value, check_keys, opts))
                      except InvalidDocument as err:
                          raise InvalidDocument(f"Invalid document: {err}", doc) from err
      

      We expected the try-except block to include encoding the _id field as well, but it explicitly does not.

      Definition of done

      Either determine why the code currently behaves this way or fix it to work as we expect.

      Pitfalls

      N/A.

            Assignee:
            Unassigned
            Reporter:
            Noah Stapp
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: