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

database helper to list installed SONManipulators

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor - P4
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.0
    • Component/s: None
    • Labels:
      None
    • Environment:
      any
    • Backwards Compatibility:
      Minor Change

      Description

      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.

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: