Uploaded image for project: 'Python Driver'
  1. Python Driver
  2. PYTHON-382

Add check_keys param to save

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 2.3
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • Fully Compatible

      From the email thread.

      "We use periods in some of our key names which means that in newer versions of pymongo validation fails even though the data would otherwise be stored fine. Could you add support to make this optional?"

      "Allowing key names with periods in them was a bug in the driver. The
      problem with using keys like this is that querying is ambiguous. The
      server can't tell the difference between "foo.foo": "bar" and "foo":

      {"foo": "bar"}

      . This bug only existed in save(), insert() always
      disallowed it. We won't be making the buggy behavior configurable."

      "I don't see an issue with doing validation automatically but if we're ok with the ambiguity (and the consequences of it) couldn't there be a keyword argument (maybe at the collection or database level) to disable validation? Otherwise we'll need to be stuck on the older version or have to fork the library."

      "I hesitate about adding a check_keys option to save because it allows
      users to do something totally wrong, allowing them to insert documents
      that they may no longer be able to query for. That being said, I just
      realized insert() has a check_keys param so there is some precedent."

            Assignee:
            bernie@mongodb.com Bernie Hackett
            Reporter:
            luke@about.me Luke Gotszling
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: