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

PyMongo 3.0 no longer returns _id when doing a replace in Collection.save()

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Fixed
    • 3.0
    • 3.0.1
    • None

    Description

      There one huge behaviour change in PyMongo 3, which is not documented if at all wished, but in my opinion is a bug (and therefore this ticket).

      In collection.py, in the save() method, we had in PyMongo 2.X:

      self.update({"_id": to_save["_id"]}, to_save, True, manipulate, safe, check_keys=check_keys, **kwargs)
              return to_save.get("_id", None)
      

      And now in PyMongo 3.0:

      self._update(sock_info, {"_id": to_save["_id"]}, to_save, True, check_keys, False, manipulate, write_concern)
      

      With no return !!! Whereas many apps base on the fact to check for the id to now if the upsert really worked.

      Attachments

        Activity

          People

            bernie@mongodb.com Bernie Hackett
            MRigal Matthieu Rigal
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: