Skip to content

add debug logging for SchemaEditor operations #152

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

Merged
merged 3 commits into from
Oct 9, 2024

Conversation

timgraham
Copy link
Collaborator

example:

./tests/runtests.py --settings=test_mongo schema.tests.SchemaTests.test_rename --debug-sql
Testing against Django installed in '/home/tim/code/django/django' with up to 3 processes
Found 1 test(s).
Creating test database for alias 'default'...
System check identified no issues (0 silenced).
F
======================================================================
FAIL: test_rename (schema.tests.SchemaTests.test_rename)
Tests simple altering of fields
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/tim/code/django/django/test/utils.py", line 443, in inner
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/home/tim/code/django/tests/schema/tests.py", line 2408, in test_rename
    assert False
AssertionError

----------------------------------------------------------------------
(0.030) db.create_collection(schema_author);

ALIAS=DEFAULT (0.002) db.schema_author.insert_many([{'name': 'foo', 'height': None, 'weight': None, 'uuid': None}]);

ALIAS=DEFAULT (0.002) db.schema_author.update_many({}, {'$rename': {'name': 'display_name'}});

ALIAS=DEFAULT (0.001) db.schema_author.aggregate([{'$match': {'$expr': {}}}, {'$limit': 21}]);

db.create_collection(...) and db.schema_author.update_many({}, {'$rename': ....}) lines are new.

Copy link
Collaborator

@aclark4life aclark4life left a comment

Choose a reason for hiding this comment

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

Nice, looks like you renamed CollectionDebugWrapper to OperationDebugWrapper and updated the wrapper to support both get_collection and get_database 👍

@timgraham timgraham force-pushed the schema-editor-logging branch from abbfe91 to 821ae79 Compare October 8, 2024 23:15
@timgraham timgraham merged commit 821ae79 into mongodb:main Oct 9, 2024
4 checks passed
@timgraham timgraham deleted the schema-editor-logging branch October 9, 2024 00:42
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.

2 participants