def update(collection_name, upsert, multi, spec, doc, safe, last_error_args):
options = <NUM_LIT:0><EOL>if upsert:<EOL><INDENT>options += <NUM_LIT:1><EOL><DEDENT>if multi:<EOL><INDENT>options += <NUM_LIT:2><EOL><DEDENT>data = __ZERO<EOL>data += bson._make_c_string(collection_name)<EOL>data += struct.pack("<STR_LIT>", options)<EOL>data += bson.BSON.encode(spec)<EOL>data += bson.BSON.encode(doc)<EOL>if safe:<EOL><INDENT>(_, update_message) = __pack_message(<NUM_LIT>, data)<EOL>(request_id, error_message) = __last_error(last_error_args)<EOL>return (request_id, update_message + error_message)<EOL><DEDENT>else:<EOL><INDENT>return __pack_message(<NUM_LIT>, data)<EOL><DEDENT>
Get an **update** message.