def update(field, value, db, collection, match=None):
    """
    Updates MongoDB documents.

    Sets ``field`` equal to ``value`` for all documents that
    meet ``match`` criteria.

    Arguments:

        field (str): Field to update.

        value (str): Update value.

        db (Database): A pymongo ``Database`` object.

        collection (str): Collection name.

        match (dict): A dictionary containing the match criteria, for example::

            {'seq_id': {'$in': ['a', 'b', 'c']}, 'cdr3_len': {'$gte': 18}}
    """
    c = db[collection]
    match = match if match is not None else {}
    if db.client.server_info()['version'].startswith('2'):
        c.update(match, {'$set': {field: value}}, multi=True)
    else:
        c.update_many(match, {'$set': {field: value}})
