简单查询:使用自定义的XxxRepository接口即可.(见 第十一章 springboot + mongodb(简单查询)) 复杂查询:使用MongoTemplate以及一些查询条件构建类(BasicDBList.BasicDBObject.Criteria等) 1.application.properties 1 #mongodb note:mongo3.x will not use host and port,only use uri 2 #spring.data.mongodb.hos
<!-------------知识的力量是无限的(当然肯定还有更简单的方法)-----------!> 当我考虑将省市区三级联动数据从mysql转入mongodb时遇到了网上无直接插入mongodb的示例(基本均是mysql插入示例).于是想到利用json文件直接导入mongodb会比较easy(SQLyog如何导出json?) 在SQLyog中写一个json格式查询语句:(省市区example如下:)看一下就能懂其中规则* SELECT'{"code":"' A