The person arrested must be discharged from the arrest upon executing and delivering to the officer, at any time before the return day of the warrant, an undertaking to the effect that the person arrested will appear on the return of the warrant and abide the order of the court or judge thereupon.