ยง 6222. Discharge of attachment. A defendant whose property or debt has been levied upon may move, upon notice to the plaintiff and the sheriff, for an order discharging the attachment as to all or a part of the property or debt upon payment of the sheriff's fees and expenses. On such a motion, the defendant shall give an undertaking, in an amount equal to the value of the property or debt sought to be discharged, that the defendant will pay to the plaintiff the amount of any judgment which may be recovered in the action against him, not exceeding the amount of the undertaking. Making a motion or giving an undertaking under this section shall not of itself constitute an appearance in the action.