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 query debug support #25

Merged
merged 1 commit into from
May 21, 2024
Merged

Conversation

timgraham
Copy link
Collaborator

fixes #24

@timgraham timgraham requested a review from Jibola May 20, 2024 12:25
@Jibola
Copy link
Collaborator

Jibola commented May 20, 2024

Additionally, this part may not be necessary because we will have standardized logging in our MongoClient. It captures the call operation details.

I'll say leave it for now, though.

@timgraham
Copy link
Collaborator Author

Thanks, I'll keep that in mind, however, I think trying to make use of that logging (capturing it, filtering it, reformatting it) would probably be more complicated than this implementation.

@timgraham timgraham merged commit 9688849 into mongodb-labs:main May 21, 2024
3 checks passed
@timgraham timgraham deleted the debugwrapper branch May 21, 2024 00:45
func = getattr(self.collection, method)
# Collection.insert_one() mutates args[0] (the document) by adding
# the _id. deepcopy() to avoid logging that version.
original_args = copy.deepcopy(args)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this deepcopy should be omitted. I just came across this in the MongoDB docs: "Copying the document to insert before adding the _id field would be prohibitively expensive for most high write volume applications."

It was surprising to me to see queries logged as if the user has supplied an _id, but perhaps it's okay.

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

Successfully merging this pull request may close these issues.

add query debug support
2 participants