If the defendant recovers judgment against the plaintiff and no appeal is taken, all the property attached, the proceeds from property attached, and the undertaking received in the action shall be delivered to the defendant upon service upon the peace officer of a certified copy of the order discharging the attachment.