-
Notifications
You must be signed in to change notification settings - Fork 104
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
serializable ObjectId #18
Comments
Oh yes, I had the same issue a while ago. Have you seen the solution for this on the original pymongo driver? |
I didn't seen the pymongo solution. I agree, it's nice to keep stuff in sync - however, i needed a solution which would work with other serializers too, like cjson. |
Sure, I agree it's better if it works on other json serializers. Not sure what to do... Will come back (soon?) with more on this... |
I'll try to bring this to the pymongo folks (soon?), as i just now realize that this is the very _pymongo package ( was kinda tired yesterday ) ... |
Perfect! |
Hey hey
It would be awesome if ObjectId's are nativeley (re)serializable. E.g. to embed them in json return values of json-rpc handlers. That way, one can avoid iterating over docs to replace certain objects with the string value ( or to write a specific handlers for the parser, if supported )
I did it by inheriting from str, making it serializable by anything which knows how to handle str. Just a couple of changes here and there to make it immutable
if you're interested, here comes a diff
The text was updated successfully, but these errors were encountered: