For the purpose of this section, the following terms have the meanings given:
(1) "expungement" means the removal of evidence of the court file's existence from the publicly accessible records;
(3) "court file" means the court file created when an eviction case is filed with the court.
The court may order expungement of an eviction case court file only upon motion of a defendant and decision by the court, if the court finds that the plaintiff's case is sufficiently without basis in fact or law, which may include lack of jurisdiction over the case, that expungement is clearly in the interests of justice and those interests are not outweighed by the public's interest in knowing about the record.
The court shall order expungement of an eviction case commenced solely on the grounds provided in section 504B.285, subdivision 1, clause (1), if the court finds that the defendant occupied real property that was subject to contract for deed cancellation or mortgage foreclosure and:
(1) the time for contract cancellation or foreclosure redemption has expired and the defendant vacated the property prior to commencement of the eviction action; or
(2) the defendant was a tenant during the contract cancellation or foreclosure redemption period and did not receive a notice under section 504B.285, subdivision 1a, 1b, or 1c, to vacate on a date prior to commencement of the eviction case.