Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for find_and_modify remove kwarg #49

Closed
angstwad opened this issue Sep 26, 2013 · 2 comments
Closed

Add support for find_and_modify remove kwarg #49

angstwad opened this issue Sep 26, 2013 · 2 comments

Comments

@angstwad
Copy link
Contributor

Ran into this today. The original document is being returned when using the remove and new kwarg...for example:

...find_and_modify(query=query, remove=True)

It causes the following exception:

  File "/Users/paul4611/python-virtualenvs/quasar/lib/python2.7/site-packages/mongomock/__init__.py", line 349, in find_and_modify
    self.update({'_id':old['_id']}, update)
  File "/Users/paul4611/python-virtualenvs/quasar/lib/python2.7/site-packages/mongomock/__init__.py", line 214, in update
    for k, v in iteritems(document):
  File "/Users/paul4611/python-virtualenvs/quasar/lib/python2.7/site-packages/six.py", line 439, in iteritems
    return iter(getattr(d, _iteritems)(**kw))
AttributeError: 'NoneType' object has no attribute 'iteritems'
@sivel
Copy link

sivel commented Sep 26, 2013

Additionally, new and remove cannot coexist. Here is a sample exception from pymongo:

OperationFailure: command SON([('findAndModify', u'test'), ('new', True), ('remove', True), ('query', {'_id': ObjectId('5244a79288b86523defdb136')})]) failed: remove and returnNew can't co-exist

vmalloc added a commit that referenced this issue Sep 27, 2013
* No longer accept remove and new, remove and update
* Propery support remove
@vmalloc
Copy link
Collaborator

vmalloc commented Sep 27, 2013

Supposed to be fixed now.

@vmalloc vmalloc closed this as completed Sep 27, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants