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()

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 3.0.1
    • Affects Version/s: 3.0
    • Component/s: None

      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.

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

              Created:
              Updated:
              Resolved: