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

Cannot pickle bson.ObjectId

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: 1.10
    • Fix Version/s: 1.10.1
    • Component/s: None
    • Labels:
      None
    • Environment:
      Ubuntu 64 bit 10.10 Python 2.6
    • # Replies:
      2
    • Last comment by Customer:
      true

      Description

      In order to save an ObjectId to disk or to pass it between processes it is best if it can be pickled. (Having to insert code all over the place to turn it into a string and back into ObjectId is a pain.)

      >>> pickle.dumps(bson.ObjectId("112233445566"))
      TypeError: a class that defines _slots_ without defining _getstate_ cannot be pickled

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Days since reply:
                7 years, 42 weeks, 2 days ago
                Date of 1st Reply: