mongodb-labs / django-mongodb

MongoDB Backend for Django
Apache License 2.0
16 stars 7 forks source link

add debug logging for SchemaEditor operations #152

Closed timgraham closed 1 month ago

timgraham commented 1 month ago

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.