Corson, J.
This is an action upon an undertaking for attachment. The defendant interposed a demurrer to the complaint, and, the demurrer being overruled and the defendant electing to stand upon his demurrer, judgment was entered in favor of the plaintiff, and from this judgment the defendant appeals.
Plaintiff’s cause of action may be summarized as follows: In August, 1896, an action was commenced in the circuit court of Brule county by one M. E. Distad against Harry A. Shanklin for the recovery of money, wherein said Distad applied for a writ of attachment against said defendant, Shanklin, and wherein said Distad and C. D. Tidrick executed and filed with the clerk of said court for the benefit of the defendant in said action, a written undertaking as required by statute, which was in the usual form. This undertaking, among other things, provided that if the defendant, Shanklin, should recover judgment against the plaintiff, or if the attachment to be issued should be set aside by order of the court, .the said Distad, as plaintiff, and said Tidrick, undertook, promised and agreed to and with said defendant that the said plaintiff should and would pay all costs that might be awarded to said defendant, and all damages that he might sustain by reason of the attachment, not exceeding the sum of $1,000; that, pursuant to said application and undertaking, the clerk of said circuit court issued a writ of attachment in the usual form; that, pursuant to said attachment, the sheriff, of said Brule county attached real property belonging to the defendant, Harry A. Shanklin, situated in said county; that while said action was pending *252and said attachment remained in force, the plaintiff therein, M. E. Distad, died, and thereafter his widow, Mary Distad, made application to the court to be substituted as plaintiff in his stead, alleging that in December, 1896, and before said M. E. Distad died, he assigned to her his right and interest in the cause of action, and she was thereupon substituted as plaintiff in said action; that thereafter such proceedings were had in such action that the defendant therein, Harry A. Shanklin, in January, 1899, recovered judgment against the plaintiff therein, said Mary Distad dismissing the action upon the merits, and for the sum of $106.65 costs; that afterwards said Mary Distad made application for a new trial, which was denied, and the court made an order vacating and setting aside said attachment, and directing the cancellation of the notice of the pendency of the action; that on March 23, 1899, an execution was issued upon said judgment against said Mary Distad, and returned unsatisfied; that plaintiff has at different times since said judgment for costs was entered, demanded of the plaintiff in that action the payment of said judgment in accordance with the terms of the undertaking, and that she has refused and still refuses to pay the same, or any part thereof; that on March 21, 1900, said judgment was by an instrument in writing duly assigned and transferred to the plaintiff herein, and duly filed in the office of the clerk of said court, and entered in the judgment book of the same. Plaintiff therefore demands judgment against said defendant for the sum of $106.65, with interest, etc., and for the costs of the action. The demurrer to the complaint was made upon the ground that the same did not state facts sufficient to constitute a cause of actiqn.
The appellant, in his brief, states specifically the grounds upon which he relies, as follows: “ (1) The undertaking made the basis of this action was executed by appellant as surety for M. E. *253Distad, the original plaintiff in the action against Shanklin, and not for Mary Distad, the substituted plaintiff in the action. (2) The undertaking was not .conditioned, nor is appellant liable thereunder, for the costs of the. action.. (3) The complaint does not show what costs, if any, were, incurred during the time that appellant’s principal was plaintiff., (4) The.same does not show any judgment against his principal. (5) There is no allegation that any effort has ever been made to collect the costs from the estate of the principal in the undertaking, nor is there any averment of the insolvency. of his estate. , (6) There is no allegation that any affidavit for attachment was ever made, nor any. facts stated showing that the clerk had jurisdiction to issue the writ of. attachment.. (7) The complaint affirmatively .shows that the substituted plaintiff was at all. times after she became a party, a .resident of the state of Iowa.” It will be observed that the first position taken by appellant is that, inasmuch as the undertaking was executed as security for, M. E. Dis-tad, the original plaintiff; and not for Mary Distad;, the substituted plaintiff the action cannot be.maintained. This, we think, is placing too limited a construction, .upon the condition of .the .undertaking. The section under, which the .undertaking’was given reads as follows: “Before issuing the .warrant, the clerk must require, a written undertaking on the part of the plaintiff, with sufficient surety to the effect that if the defendant recoyer judgment, or the attachment be set aside by the order, of the. court, the plaintiff will pay; all. costs that may be, awarded to. the ■ defendant, and all damages which he may sustain by .reason o.f the attachment, not exceeding.th.e sum named in the undertaking, which must be at least the amount of. the claim specified in the affidavit, and.in no case less than $250.” .Section 4996, Comp. Laws.. While it is true that the undertaking is given on the. part of the appellant that1 the plaintiff will pay all; costs that may *254be awarded to the defendant, etc., still we are of the opinion that the plaintiff here spoken of is any plaintiff that may legally become such during the pendency of the action. In case of the death of the plaintiff who institutes the action it would hardly be contended that the administrator or executor might not properly be substituted, and that the judgment against such administrator or executor so substituted would ,in effect, be a judgment against the plaintiff; and we think the same reasoning should apply to the substitution of a plaintiff by assignment made by the original plaintiff. The object and purpose of the undertaking is to protect the defendant against costs and damages by reason of the attachment. The fact, therefore, that the original plaintiff has ceased to be such, and that a third party has been substituted as plaintiff in his stead, cannot be permitted to defeat the object and purpose of the statute. While no case directly in point has been called to our attention, cases quite analogous have arisen in which it has been held that the fact that there was a change in the parties did not affect the right of a party to recover on his undertaking. In Slosson v. Ferguson, 31 Minn. 448, 18 N. W. 281, it was held that where a plaintiff, to whom a bond on release of the attachment had been executed, had assigned the same pursuant to the statute for the benefit of creditors, and the asignee was substituted as plaintiff in the action, and procured judgment therein, the obligors in the bond became liable to the assignee thereon; and the court in its opinion said: “The bond is such as the statute prescribes. As is contemplated by the statute, the bond was executed personally to the plaintiff in a specified action. In that part of the statute prescribing the condition the words ‘the plaintiff’ refer to the same person named as obligee. In this connection the import of the words ‘the plaintiff’ and ‘said plaintiff’ in the bond is the same; but, while the obligation is in terms assumed only in favor of a par*255ticular person, it is to be construed in connection with existing law pursuant to which it is made, and with regard to the objects plainly sought to be accomplished by the bond executed in compliance with the statute. * * * The statutory security which took the place of the attached property went along with the action as continuing security notwithstanding the transfer of the cause of action, and the consequent substitution of parties, by means of which the real party in interest was retained as plaintiff.” So we may say in the case at bar the undertaking which was given as security to the defendant necessarily went along with the action as continuing security notwithstanding the transfer of the cause of action. It was not in the power of the defendant to prevent the substitution, as the plaintiff Mary Distad had a legal right to be substituted in place of her deceased husband; the cause of action being one that survived, notwithstanding his death. We are clearly of the opinion, therefore, that the position of the appellant upon this point is not tenable, and that the surety continued liable as such surety for the lawful plaintiff in the action at the time the judgment was recovered against her by the defendant. Cockroft v. Clafin, 64 Barb, 464, affirmed in 53 N. Y. 618; Gilmore v. Crowell, 67 Barb, 62; Bell v. Walker, 54 Neb. 222, 74 N. W. 617.
The appellant further contends that the undertaking was not conditioned, nor the appellant liable thereunder, for the costs of the action. It will be noticed that by the provisions of Section 4996, above quoted, one of the conditions of the undertaking is required to be that, “if the defendant ■ recover judgment, * •* * the plaintiff will pay all costs that may be awarded to the defendant, and all damages which he may sustain by reason of the attachment.” The undertaking in this action, it will be observed, was drawn in conformity with the statute. The theory of the appellant seems to be tha# *256the term “costs,” as used in the statute, is qualified by the term “by reason of the attachment,” and does not refer to the ordinary costs of the action; but this contention is not tenable. “The costs,” as used in the statute, means the costs of the action in which the attachment is issued, and is not qualified by the expression, “by reason of the attachment.” That qualification applies only to the damages that may be recovered. This section of our. Code is the same as Section 640 of the Code of Civil Procedure of the State of New York, requiring undertakings on attachment, except that “clerk” is substituted for “judge.”. In the case of Lee v. Homer, 37 Hun, 634, the supreme court of that state gave a similar construction to this section, and held that the sureties upon an undertaking given upon the issuing of an attachment are liable for the costs of an action awarded to the defendant upon the dismissal of the complaint, even though the attachment itself be never formally vacated; and they further held that the words, “which he may sustain by reason of the attachment” apply only to the word “damages,” and not to the words “costs which may be awarded to the defendant.” It was contended in that case, as-in this, that the surety was not liable for the costs of the action itself, but, as we have seen, that learned court held otherwise ; and this decision was affirmed by the court of appeals of New York in a memorandum opinion. 109 N. Y. 630, 15 N. E. 896.
The third, fourth and fifth points made by counsel for the appellant are not of sufficient merit to require an extended consideration. The defendant, as we have seen, was entitled to all the costs incurred by him in. the action, and it was not material what portion was incurred by the original plaintiff, or what was incurred by the substituted plaintiff.. .And for the reasons above stated it was not necessary to show a judgment against the original plaintiff. Nor was it necessary that any effort should have been made to colject the *257costs from the estate of the principal in the undertaking, as it affirmatively appears from the record that Mary Distad was properly substituted as plaintiff, and the real party in interest, and was, therefore, primarily liable for the costs of the action.
' It is further contended on the part of the appellant that there was no allegation that any affidavit for attachment was even made, nor any facts stated showing that the clerk had jurisdiction to issue the writ of attachment. It is, however, stated in the complaint that the plaintiff made application for a warrant of attachment, and that a warrant of attachment was issued. It must be presumed, therefore, in support of the judgment, in the absence of any showing to the contrary, that the proper affidavit was filed with the clerk, as the clerk could not legally issue the warrant until an affidavit was filed, and the presumption is that every public officer has done his duty. But, if such was not the presumption, the failure to allege that a proper affidavit was filed would not necessarily render the complaint insufficient. As the action is upon the undertaking, the parties are estopped in this collateral action from questioning the regularity of the attachment. As the action is based upon the attachment, the proceedings in the attachment need not be set out. Dunn v. Crocker, 22 Ind. 324; Trentman v. Wiley, 85 Ind. 33; Zachman v. Haak, 85 Wis. 656, 56 N. W. 158. The judgment of the circuit court and the order denying a new trial are affirmed.