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

database helper to list installed SONManipulators

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 2.0
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • Environment:
      any
    • Minor Change

      Consider the following code example:

      >>> class MyManipulator(SONManipulator):
      ... def transform_incoming(self, son, collection):
      ... print "Transforming!"
      ... return son
      >>> m = MyManipulator()
      >>> db.add_son_manipulator(m)
      >>> db.add_son_manipulator(m)
      >>> db.add_son_manipulator(m)
      >>> db.add_son_manipulator(m)
      >>> db.add_son_manipulator(m)
      >>> col = db.foobar
      >>> col
      Collection(Database(Connection('localhost', 27017), u'playhaven'), u'foobar')
      >>> db.foobar.insert(

      {'a' : 1}

      )
      Transforming!
      Transforming!
      Transforming!
      Transforming!
      Transforming!
      ObjectId('4c58593d860f970350000001')

      It's easy to see how this could cause performance problems if extra care is not taken. What would be nice is if the method would only add the same SONManipulator once. Or at a very minimum, there should be a way to check and see if the SONManipulator has already been added.

            Assignee:
            bernie@mongodb.com Bernie Hackett
            Reporter:
            amnorvend Jason Baker
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: