MongoDB Java Spring Data

Source: Internet
Author: User
Tags lowercase

    1. There have been a lot of introductions about how to integrate Spring-data-mongodb into a project, and here are just a few links.
      1. GETTING STARTED accessing Data with mongodb:http://spring.io/guides/gs/accessing-data-mongodb/
      2. A preliminary study on MongoDB (ii)----using Spring-data configuration mongodb:http://yangjizhong.iteye.com/blog/1206901
      3. Three ways to integrate spring and MongoDB using tutorials: http://my.oschina.net/yilian/blog/175525
    2. Project background
      1. began to complete the project in C #, using the MongoDB database, the customer requested to complete a b\s version of the corresponding program.
      2. The b\s version is in the Java language, and the database needs to complete the CRUD operations on MongoDB.
      3. Research, and finally decided to use spring data MongoDB to accomplish this task, the specific development configuration do not repeat.
    3. Encounter problems

Everyone familiar with C # knows that C # is a feature that uses attributes to generate objects, and that properties are generally capitalized, which means that if you do not do this, the program on this side of C # will be capitalized if it is stored in MongoDB. With the platform, the same language will not have the next problem. Java Bean writing is usually getter Setter, and then a private field, of course, the first letter of the field is lowercase! So to MONGO inside will be the first letter lowercase. So the problem is, there is already a library is capitalized, then Java read the data here is not coming back, read is null. Helpless, had to change bigger write, problem solve.

But the second problem comes again, in the query, the condition key is STRING,OMG, Daniel's convert automatically to lowercase, and then the exception (the property is not found). Well, I can only find another solution, @Filed, that's him.

The third problem, Java does not build library directly stored MONGO, more than a field _class, the value is the type of this document, but I really do not need this thing, if more of this thing, my C # program should be an error. Fortunately there are google,http://www.mkyong.com/mongodb/spring-data-mongodb-remove-_class-column/.

Summarize:

    1. Spring is a good thing, spring data is also under the tree good shade, so or learn spring-data.
    2. The speed at which the wheels are made is far more than the speed at which I have to use the wheels, and each frame has its own application, so as to choose the right technology.
    3. Cross-language is really a problem, so it's better to design these questions in advance.
    4. MAVEN makes project reference management more useful than nuget.
    5. No Lamda day can only knock more code, wait for the project to upgrade Java 8.
    6. MongoDB Drive Package Thousands, let's try it out.

PS: No code, Welcome to the exchange, there is a brick light pat.

MongoDB Java Spring Data

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.