def find_record(self, collection_name, query):
        """
        Return the first record mathing the given Mongo query.

        :param collection_name: Name of the collection to search in.
        :param query: MongoDB Query, e.g. {_id: 123}
        :return: A single MongoDB record or None if not found.

        :raise DataSourceError
        """
        cursor = self._get_collection(collection_name).find(query)
        for record in cursor:
            # Return the first record found.
            return record
        # Return None if nothing found.
        return None
Return the first record mathing the given Mongo query.

        :param collection_name: Name of the collection to search in.
        :param query: MongoDB Query, e.g. {_id: 123}
        :return: A single MongoDB record or None if not found.

        :raise DataSourceError