spring mongodb用法
2016-01-28 09:00
513 查看
A field annotated with @Id (org.springframework.data.annotation.Id) will be mapped to the '_id' field.
A field without an annotation but named 'id' will be mapped to the '_id' field.
需要包括maven依赖
spring配置
指定host。
参考
http://docs.spring.io/spring-data/data-mongo/docs/1.4.2.RELEASE/reference/html/mongo.repositories.html http://docs.spring.io/spring-data/data-mongo/docs/1.8.1.RELEASE/reference/html/#mongo.repositories http://docs.spring.io/spring-data/data-mongo/docs/1.8.1.RELEASE/reference/html/#mapping-conventions http://docs.spring.io/spring-data/data-mongo/docs/1.4.2.RELEASE/reference/html/mongo.repositories.html
A field without an annotation but named 'id' will be mapped to the '_id' field.
需要包括maven依赖
<dependency> <groupId>org.springframework.data</groupId> <artifactId>spring-data-commons</artifactId> <version>1.11.1.RELEASE</version> </dependency>
spring配置
<bean id="mongo" class="org.springframework.data.mongodb.core.MongoFactoryBean"> <property name="host" value="localhost"/> </bean>
指定host。
参考
http://docs.spring.io/spring-data/data-mongo/docs/1.4.2.RELEASE/reference/html/mongo.repositories.html http://docs.spring.io/spring-data/data-mongo/docs/1.8.1.RELEASE/reference/html/#mongo.repositories http://docs.spring.io/spring-data/data-mongo/docs/1.8.1.RELEASE/reference/html/#mapping-conventions http://docs.spring.io/spring-data/data-mongo/docs/1.4.2.RELEASE/reference/html/mongo.repositories.html
相关文章推荐
- MongoDB学习领悟: 文档的书写是基于K-V的map演算形式
- mongodb中最为简单的一种安装方法
- MongoDB 数据类型
- Nutch+MongoDB+ElasticSearch+Kibana 搭建搜索引擎
- mongodb 特殊作用的数据库
- MongoDb web 用户界面
- MongoDB 应用案例
- MongoDB 工具
- mongodb 加载多个文件
- windows下启动mongodb
- 开启MongoDB客户端访问控制
- 在Windows上安装MongoDB
- spring-data-mongodb报错
- MongoDB介绍
- 配置MongoDB3.04集群分片
- mongoDb地理空间索引和查询
- MongoDB安全的3A -- 认证(Authentication)、授权(Authorization)和审计(Audit
- mongodb慢查询定位
- Mongodb Sharding+Replica Set
- MongoDB replSet