(collection_name, upsert, multi,
           spec, doc, safe, last_error_args, check_keys, opts)
Get an **update** message.
Get an **update** message.
Get an ** update ** message .
def update(collection_name, upsert, multi,
           spec, doc, safe, last_error_args, check_keys, opts):
    """Get an **update** message.
    """
    options = 0
    if upsert:
        options += 1
    if multi:
        options += 2

    data = _ZERO_32
    data += bson._make_c_string(collection_name)
    data += struct.pack("<i", options)
    data += bson.BSON.encode(spec, False, opts)
    encoded = bson.BSON.encode(doc, check_keys, opts)
    data += encoded
    if safe:
        (_, update_message) = __pack_message(2001, data)
        (request_id, error_message, _) = __last_error(collection_name,
                                                      last_error_args)
        return (request_id, update_message + error_message, len(encoded))
    else:
        (request_id, update_message) = __pack_message(2001, data)
        return (request_id, update_message, len(encoded))
def update ( collection_name , upsert , multi , spec , doc , safe , last_error_args , check_keys , opts ) : options = 0 if upsert : options += 1 if multi : options += 2 data = _ZERO_32 data += bson . _make_c_string ( collection_name ) data += struct . pack ( "<i" , options ) data += bson . BSON . encode ( spec , False , opts ) encoded = bson . BSON . encode ( doc , check_keys , opts ) data += encoded if safe : ( _ , update_message ) = __pack_message ( 2001 , data ) ( request_id , error_message , _ ) = __last_error ( collection_name , last_error_args ) return ( request_id , update_message + error_message , len ( encoded ) ) else : ( request_id , update_message ) = __pack_message ( 2001 , data ) return ( request_id , update_message , len ( encoded ) )