def __getattr__(self, name):
        if name in self._document:
            return self._document[name]
        elif name in dir(self.collection):
            attribute = getattr(self.collection, name)

            if inspect.isfunction(attribute):
                attribute = types.MethodType(attribute, self)

            return attribute
        else:
            raise AttributeError(name)
Returns the attribute from the _document if it exists.
dataset/ETHPy150Open lvieirajr/mongorest/mongorest/collection.py/Collection.__getattr__