cobrateam / flask-mongoalchemy

Flask support for MongoDB using MongoAlchemy.
https://pythonhosted.org/Flask-MongoAlchemy/
BSD 2-Clause "Simplified" License
217 stars 45 forks source link

Incompatible with the latest pymongo #41

Open inaferando opened 9 years ago

inaferando commented 9 years ago

keyword 'safe' is not expected in save operations since 3.0 version of pymongo

  File "/usr/local/lib/python2.7/dist-packages/flaskext/mongoalchemy/__init__.py", line 264, in save
    self._session.insert(self, safe=safe)
  File "/usr/local/lib/python2.7/dist-packages/mongoalchemy/session.py", line 172, in insert
    self.add(item, safe=safe)
  File "/usr/local/lib/python2.7/dist-packages/mongoalchemy/session.py", line 188, in add
    return self.flush()
  File "/usr/local/lib/python2.7/dist-packages/mongoalchemy/session.py", line 414, in flush
    result = op.execute()
  File "/usr/local/lib/python2.7/dist-packages/mongoalchemy/ops.py", line 97, in execute
    return self.collection.save(self.data, safe=self.safe)
  File "/usr/local/lib/python2.7/dist-packages/pymongo/collection.py", line 1898, in save
    write_concern = WriteConcern(**kwargs)
TypeError: __init__() got an unexpected keyword argument 'safe'
EmergentBehavior commented 9 years ago

Also had this issue and had to stick with an older version. Would be nice if this was addressed.

fsouza commented 9 years ago

Unfortunately this is a bug with MongoAlchemy. I will pin the pymongo version to ensure that everything works fine, and once it's fixed in MongoAlchemy, I will fix it here as well.