Spring and MongoDB implement aggregation query

Integrate MongoDB and Spring, find the corresponding version according to the development document. According to official documents, we know that Spring must be version 3.0.x or above, and MongoDB must be version 1.6.5 or above. If you want to integrate Spring and Mongodb, you must download the corresponding jar. There are mainly two jars used here, one is spring-data-document and spring- There are two types of jars in data-commons, but the versions of the two types of jars must match to avoid jar conflicts, because the jar directory of the version behind commons has changed for all versions This must be corresponding to the following is the jar download address http://www.springsource.org/spring-data/mongodb http://www.springsource.org/spring-data/commons The following is the jar I downloaded and add the mongodb java driver package, spring I won’t say more about jar addition The Spring configuration file is as follows: 1. 2. <beans xmlns="http://www.springframework.org/schema/beans"  3. xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” 4. xmlns:cOntext=”http://www.springframework.org/schema/context” 5. xmlns:mOngo=”http://www.springframework.org/schema/data/mongo” 6. xsi:schemaLocation= 7. “http://www.springframework.org/schema/context 8.      http://www.springframework.org/schema/context/spring-context-3.0.xsd  9. http://www.springframework.org/schema/data/mongo 10. http://www.springframework.org/schema/data/mongo/spring-mongo-1.0.xsd 11. http://www.springframework.org/schema/beans 12. http://www.springframework.org/schema/beans/spring-beans-3.0.xsd”>  13. 14.   15. 16. 17. <bean id="mongoTemplate" class=”org.springframework.data.document.mongodb.MongoTemplate”> 18. 19. 20. 21. 22. <bean id="personRepository" class=”com.mongo.repository.PersonRepository”>  23. 24. 26. 27. the 28. 29. the 30. 31. 32. 33. 34. 35. the Define the interface…

Contact Us

Contact us

181-3619-1160

Online consultation: QQ交谈

E-mail: [email protected]

Working hours: Monday to Friday, 9:00-17:30, holidays off

Follow wechat
Scan wechat and follow us

Scan wechat and follow us

Follow Weibo
Back to top
首页
微信
电话
搜索