'Create a replace document and add it to the list of ops.'

def add_replace(self, selector, replacement, upsert=False, collation=None):

    validate_ok_for_replace(replacement)
    cmd = SON([('q', selector), ('u', replacement), ('multi', False), ('upsert', upsert)])
    collation = validate_collation_or_none(collation)
    if (collation is not None):
        self.uses_collation = True
        cmd['collation'] = collation
    self.ops.append((_UPDATE, cmd))
