Uploaded image for project: 'Python Driver'
  1. Python Driver
  2. PYTHON-342

NUL in database name should raise InvalidName

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 2.2
    • Affects Version/s: None
    • Component/s: None
    • None

      import pymongo
      c = pymongo.Connection()
      coll = c[u'x\u0000'].test
      coll.create_index([('x',1)])
      
      Traceback (most recent call last):
        File "<stdin>", line 1, in <module>
        File "/usr/lib/python2.7/dist-packages/pymongo/collection.py", line 715, in create_index
          safe=True)
        File "/usr/lib/python2.7/dist-packages/pymongo/collection.py", line 312, in insert
          continue_on_error, self.__uuid_subtype), safe)
        File "/usr/lib/python2.7/dist-packages/pymongo/connection.py", line 822, in _send_message
          return self.__check_response_to_last_error(response)
        File "/usr/lib/python2.7/dist-packages/pymongo/connection.py", line 772, in __check_response_to_last_error
          raise OperationFailure(error["err"], error["code"])
      pymongo.errors.OperationFailure: Invalid BSONObj size: 1937339182 (0x2E737973) first element: em.indexes: ?type=116
      

      "c[u'x\u0000']" should raise pymongo.errors.InvalidName, instead of blowing up the database connection.

            Assignee:
            bernie@mongodb.com Bernie Hackett
            Reporter:
            glenn Glenn Maynard
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: