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

Cannot pickle bson.ObjectId

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Fixed
    • 1.10
    • 1.10.1
    • None
    • None
    • Ubuntu 64 bit 10.10 Python 2.6

    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

            bernie@mongodb.com Bernie Hackett
            rogerbinns Roger Binns
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: