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

Can't serialize ObjectId #107

Open
Saluev opened this issue Jun 9, 2021 · 1 comment
Open

Can't serialize ObjectId #107

Saluev opened this issue Jun 9, 2021 · 1 comment
Labels

Comments

@Saluev
Copy link

Saluev commented Jun 9, 2021

Funny thing: I seem unable to serialize document containing ObjectId generated by this very same library 🤔

>>> bson.dumps({"_id": bson.ObjectId()})
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.9/site-packages/bson/__init__.py", line 39, in dumps
    return encode_document(obj, [],
  File "/usr/local/lib/python3.9/site-packages/bson/codec.py", line 238, in encode_document
    encode_value(name, value, buf, traversal_stack,
  File "/usr/local/lib/python3.9/site-packages/bson/codec.py", line 226, in encode_value
    raise UnknownSerializerError(name, value)
bson.codec.UnknownSerializerError: Unable to serialize: key '_id' value: 60c11e2272af374b05e46919 type: <class 'bson.objectid.ObjectId'>

What am I doing wrong?

@Parkayun Parkayun added the bug label Sep 8, 2021
@Parkayun
Copy link
Member

Parkayun commented Sep 8, 2021

Thank you for your report

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants