def connection(self):
        """Connect to and return mongodb database object."""
        if self._connection is None:

            self._connection = self.client[self.database_name]

            if self.disable_id_injector:
                incoming = self._connection._Database__incoming_manipulators
                for manipulator in incoming:
                    if isinstance(manipulator,
                                  pymongo.son_manipulator.ObjectIdInjector):
                        incoming.remove(manipulator)
                        LOG.debug("Disabling %s on mongodb connection to "
                                  "'%s'.",
                                  manipulator.__class__.__name__,
                                  self.database_name)
                        break

            for manipulator in self.manipulators:
                self._connection.add_son_manipulator(manipulator)
            LOG.info("Connected to mongodb on %s (database=%s)",
                     self.safe_connection_string, self.database_name)

        return self._connection
Connect to and return mongodb database object.