prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Rename modifier missing from update
  Not sure if this is intentional or not but it would be useful to have the `$rename` operator (or "modifier" for the update method for QuerySet and Document) available.
  
  I'm currently working around it with `exec_js`, like so:
  
  ``` python
  Document.objects.exec_js("""
  function() {
    db[collection].update({}, {$rename: {foo: 'bar'}});
  }""")
  ```
  
  
  </issue>
  <code>
  [start of mongoengine/base/common.py]
  1 from mongoengine.errors import NotRegistered
  2 
  3 __all__ = ('UPDATE_OPERATORS', 'get_document', '_document_registry')
  4 
  5 
  6 UPDATE_OPERATORS = set(['set', 'unset', 'inc', 'dec', 'pop', 'push',
  7                         'push_all', 'pull', 'pull_all', 'add_to_set',
  8                         'set_on_insert', 'min', 'max'])
  9 
  10 
  11 _document_registry = {}
  12 
  13 
  14 def get_document(name):
  15     """Get a document class by name."""
  16     doc = _document_registry.get(name, None)
  17     if not doc:
  18         # Possible old style name
  19         single_end = name.split('.')[-1]
  20         compound_end = '.%s' % single_end
  21         possible_match = [k for k in _document_registry.keys()
  22                           if k.endswith(compound_end) or k == single_end]
  23         if len(possible_match) == 1:
  24             doc = _document_registry.get(possible_match.pop(), None)
  25     if not doc:
  26         raise NotRegistered("""
  27             `%s` has not been registered in the document registry.
  28             Importing the document class automatically registers it, has it
  29             been imported?
  30         """.strip() % name)
  31     return doc
  32
  [end of mongoengine/base/common.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/mongoengine/base/common.py b/mongoengine/base/common.py
  --- a/mongoengine/base/common.py
  +++ b/mongoengine/base/common.py
  @@ -5,7 +5,7 @@
   
   UPDATE_OPERATORS = set(['set', 'unset', 'inc', 'dec', 'pop', 'push',
                           'push_all', 'pull', 'pull_all', 'add_to_set',
  -                        'set_on_insert', 'min', 'max'])
  +                        'set_on_insert', 'min', 'max', 'rename'])
   
   
   _document_registry = {}
  
verification_info: {"golden_diff": "diff --git a/mongoengine/base/common.py b/mongoengine/base/common.py\n--- a/mongoengine/base/common.py\n+++ b/mongoengine/base/common.py\n@@ -5,7 +5,7 @@\n \n UPDATE_OPERATORS = set(['set', 'unset', 'inc', 'dec', 'pop', 'push',\n                         'push_all', 'pull', 'pull_all', 'add_to_set',\n-                        'set_on_insert', 'min', 'max'])\n+                        'set_on_insert', 'min', 'max', 'rename'])\n \n \n _document_registry = {}\n", "issue": "Rename modifier missing from update\nNot sure if this is intentional or not but it would be useful to have the `$rename` operator (or \"modifier\" for the update method for QuerySet and Document) available.\n\nI'm currently working around it with `exec_js`, like so:\n\n``` python\nDocument.objects.exec_js(\"\"\"\nfunction() {\n  db[collection].update({}, {$rename: {foo: 'bar'}});\n}\"\"\")\n```\n\n", "before_files": [{"content": "from mongoengine.errors import NotRegistered\n\n__all__ = ('UPDATE_OPERATORS', 'get_document', '_document_registry')\n\n\nUPDATE_OPERATORS = set(['set', 'unset', 'inc', 'dec', 'pop', 'push',\n                        'push_all', 'pull', 'pull_all', 'add_to_set',\n                        'set_on_insert', 'min', 'max'])\n\n\n_document_registry = {}\n\n\ndef get_document(name):\n    \"\"\"Get a document class by name.\"\"\"\n    doc = _document_registry.get(name, None)\n    if not doc:\n        # Possible old style name\n        single_end = name.split('.')[-1]\n        compound_end = '.%s' % single_end\n        possible_match = [k for k in _document_registry.keys()\n                          if k.endswith(compound_end) or k == single_end]\n        if len(possible_match) == 1:\n            doc = _document_registry.get(possible_match.pop(), None)\n    if not doc:\n        raise NotRegistered(\"\"\"\n            `%s` has not been registered in the document registry.\n            Importing the document class automatically registers it, has it\n            been imported?\n        \"\"\".strip() % name)\n    return doc\n", "path": "mongoengine/base/common.py"}]}