The present invention discloses an FXR receptor agonist, belongs to the technical field of medicine, and particularly relates to a compound represented by a formula (I), a pharmaceutically acceptablesalt, an ester or a stereoisomer thereof, wherein R<1>, R<2>, R<3>, M, L, L1, W, A , B, Q, m and n are defined in the specification. The present invention further relates to a preparation method of the compound, a pharmaceutical preparation, and applications in preparation of drugs for treatment and/or prevention of nonalcoholic fatty liver disease, primary biliary cirrhosis, lipid metabolism disorder, diabetic complication, malignant tumors and other related diseases mediated by FXR receptors. The formula I is defined in the specification.