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

ObjectId is not checked during DeepDiff() #381

Open
patryk-matis opened this issue Mar 20, 2023 · 4 comments
Open

ObjectId is not checked during DeepDiff() #381

patryk-matis opened this issue Mar 20, 2023 · 4 comments

Comments

@patryk-matis
Copy link

Describe the bug
DeepDiff is not pointing out different objectIds (bson/mongodb) in dicts.

To Reproduce
Create two dicts with two different ObjectId inside of them and use DeepDiff()

Expected behavior
{'old_value': ObjectId('64131f792bbc01b7f84f1dd7'), 'new_value': ObjectId('64131f792bbc01b7f84f1db1'}

OS, DeepDiff version and Python version (please complete the following information):

  • OS: Win11/WSL
  • Python Version 3.9.16
  • DeepDiff Version 6.3.0

Additional context
Parsing these objectIds to a string using str() works well, but this is just a workaround

@seperman
Copy link
Owner

seperman commented Mar 20, 2023 via email

@seperman
Copy link
Owner

I wonder if we need to provide some sort of API for people to be able to register objects like above to DeepHash and let it know how it should be computing their hash. Something like custom_hash_for_types={bson: lambda x: x.some_attribute}
What do you think?

@seperman
Copy link
Owner

Hi @patryk-matis
Please provide reproducible code. Otherwise, I plan to close the tickets that I can't reproduce.

@gabriel-andersson
Copy link

I have the same problem:
My code:
deepdiff.DeepDiff({"a": bson.ObjectId("64235a0920937280bdd9bab9")}, {"a": bson.ObjectId("64235a0920937280bdd9bab4")})
gives the result {}

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