Before making the order, the judge shall require an undertaking on the part of the plaintiff, with one or more sufficient sureties, to the effect that the plaintiff will pay all costs that may be adjudged to the defendant, and all damages that the defendant may sustain by reason of the arrest if the same be wrongful or without sufficient cause, not exceeding the sum specified in the undertaking. The undertaking shall be in a sum to be fixed by the judge, but not less than $300.