#NEWLINE# def validate_ok_for_replace( replacement ) : #NEWLINE# #INDENT# 'Validate a replacement document.' #NEWLINE# validate_is_mapping ( 'replacement' , replacement ) #NEWLINE# if ( replacement and ( not isinstance ( first , RawBSONDocument ) ) ) : #NEWLINE# #INDENT# first = next ( iter ( replacement ) ) #NEWLINE# if first . startswith ( '$' ) : #NEWLINE# #INDENT# raise ValueError ( 'replacement can not include $ operators' )