def update(self, key, data):
        """Update document by key with partial data.

        Updates the document matching _id=<key> with 'data'
            Where 1st argument 'key' is <key>

        'data' may contain dot notation fields in
        order to specify nested values in the documents, e.g.

            collection.update(<document_key>,
                              {'my.nested.field': 'match!'})

        The dictionary provided as 'data' will update only
        those corresponding fields and subfields in the database
        document, without clobbering other fields and
        subfields.

        :returns: count of records added/updated
        """
        if key:
            spec = {'_id': key}

        write = data.copy()

        response = self._collection.update(
            spec, {'$set': write}, multi=False, upsert=False, manipulate=True)

        if response.get('ok') != 1:
            raise SimplMongoError("Error updating document '%s': %s" %
                                  (spec.get('_id'), response.errmsg))
        LOG.debug("DB UPDATE: %s.%s", self.collection_name, response)
        return response.get('n')
Update document by key with partial data.

        Updates the document matching _id=<key> with 'data'
            Where 1st argument 'key' is <key>

        'data' may contain dot notation fields in
        order to specify nested values in the documents, e.g.

            collection.update(<document_key>,
                              {'my.nested.field': 'match!'})

        The dictionary provided as 'data' will update only
        those corresponding fields and subfields in the database
        document, without clobbering other fields and
        subfields.

        :returns: count of records added/updated