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

Dumping PyMongo cursor does not serialize first item #303

Closed
Mise opened this Issue Oct 15, 2015 · 0 comments

Comments

Projects
None yet
2 participants
@Mise

Mise commented Oct 15, 2015

We are currently trying to upgrade Marshmallow from version 1.1.0 to the latest version. As our internal tests started failing we discovered a commit that breaks serializing PyMongo cursors. The commit is 48903a3.

Changing obj_prototype = obj[0] to obj_prototype = next(iter(obj)) causes the cursor position to change. When the serialization in the subsequent steps progresses the first item will not be serialized (as the cursor now points to the next item).

Workarounds:

  • Converting the cursor to a list before passing it to dump().
  • Setting update_fields = False when calling dump().

@sloria sloria closed this Oct 16, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment