ExportXMLWordPrintableJSON

    • Type: Build Failure
    • Resolution: Done
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: django
    • None
    • Python Drivers
    • Not Needed
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?
    • None
    • None
    • None
    • None
    • None
    • None

      Name of Failure:

      Task run-tests on build variant tests-7-auth-ssl (Evergreen project django-mongodb-backend): all four subtests of model_fields.test_jsonfield.TestQuerying.test_in_json_whitespace error with NotSupportedError.

      Link to task:

      https://spruce.corp.mongodb.com/task/django_mongodb_backend_tests_7_auth_ssl_run_tests_6acacdfe2860a60007e8fb8a_26_10_10_23_45_02/logs?execution=0&sorts=STATUS%3AASC

      Context of when and why the failure occurred:

      New regression from a change outside this repo. Revision b20bb6c passed on this variant on 2026-09-29 and 2026-10-03, then failed on 2026-10-10. CI clones mongodb-forks/django (mongodb-6.1.x) fresh each run, so the failure came from the fork: test_in_json_whitespace is a new upstream Django test that creates a model with a RawSQL field value. The backend rejects RawSQL on insert with NotSupportedError by design, failing the whole run-tests task. Duplicate search of INTPYTHON and PYTHON found no existing ticket.

      Stack trace:

      ======================================================================
      ERROR [0.000s]: test_in_json_whitespace (model_fields.test_jsonfield.TestQuerying.test_in_json_whitespace) (raw='{"a":1}')
      ----------------------------------------------------------------------
      Traceback (most recent call last):
        File "/data/mci/3c68626e50ab432d62abd99deeb9385d/src/django_repo/tests/model_fields/test_jsonfield.py", line 1074, in test_in_json_whitespace
          obj = NullableJSONModel.objects.create(
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/data/mci/3c68626e50ab432d62abd99deeb9385d/src/django_repo/django/db/models/manager.py", line 87, in manager_method
          return getattr(self.get_queryset(), name)(*args, **kwargs)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/data/mci/3c68626e50ab432d62abd99deeb9385d/src/django_repo/django/db/models/query.py", line 752, in create
          obj.save(force_insert=True, using=self.db)
        File "/data/mci/3c68626e50ab432d62abd99deeb9385d/src/django_repo/django/db/models/base.py", line 904, in save
          self.save_base(
        File "/data/mci/3c68626e50ab432d62abd99deeb9385d/src/django_repo/django/db/models/base.py", line 996, in save_base
          updated = self._save_table(
                    ^^^^^^^^^^^^^^^^^
        File "/data/mci/3c68626e50ab432d62abd99deeb9385d/src/django_repo/django/db/models/base.py", line 1201, in _save_table
          results = self._do_insert(
                    ^^^^^^^^^^^^^^^^
        File "/data/mci/3c68626e50ab432d62abd99deeb9385d/src/django_repo/django/db/models/base.py", line 1253, in _do_insert
          return manager._insert(
                 ^^^^^^^^^^^^^^^^
        File "/data/mci/3c68626e50ab432d62abd99deeb9385d/src/django_repo/django/db/models/manager.py", line 87, in manager_method
          return getattr(self.get_queryset(), name)(*args, **kwargs)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/data/mci/3c68626e50ab432d62abd99deeb9385d/src/django_repo/django/db/models/query.py", line 2166, in _insert
          return query.get_compiler(using=using).execute_sql(returning_fields)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/data/mci/3c68626e50ab432d62abd99deeb9385d/src/django_mongodb_backend/compiler.py", line 1243, in execute_sql
          raise NotSupportedError(
      django.db.utils.NotSupportedError: MongoDB does not support creating models with expressions: got RawSQL(%s, ['{"a":1}']) for field value.
      ----------------------------------------------------------------------
      Ran 570 tests in 34.605s
      FAILED (errors=4, skipped=108, expected failures=9)
      

      The other three failing subtests are identical except for the raw value: '

      { "a" : 1 }

      ', '[1,2]', '[ 1, 2 ]'.

            Assignee:
            Steve Silvester
            Reporter:
            Steve Silvester
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: