Spring Boot Tutorial (35) using the MongoDB database (1)

Source: Internet
Author: User
Tags mongodb spring boot tutorial

About MongoDB

MongoDB is a distributed file-based database that is a product between relational and non-relational databases, with the main goal of building a bridge between key/value storage (which provides high performance and high scalability) and traditional RDBMS systems (with rich functionality). It combines the advantages of both.

MongoDB supports a very loose data structure, a JSON-like Bson format, so it can store more complex data types, and because his storage format makes it very fluid to store the data in the NODEJS program application.

Since it is called a NoSQL database, the query language of MONGO is very powerful, its syntax is somewhat similar to object-oriented query language, almost can realize the most functions like relational database single table query, but also support the indexing of data.

However, MongoDB is not omnipotent, compared to MySQL and other relational databases, they have their own unique advantages for different data types and transaction requirements. In the choice of data storage, adhere to the principle of diversification, choose a better and more economical way, rather than top-down unification.

More commonly, we can directly use MongoDB to store key value pairs of data types, such as: Verification Code, session, etc. due to MongoDB's scale-out capability, it can also be used to store data that is very large in the future, such as: logs, comments, etc. Because MongoDB stores the weak type of data, it can also be used to store some changeable JSON data, such as: the interaction with the external system is often changed JSON message. For some operations that have complex, high-transactional requirements for data, such as account transactions, it is not appropriate to use MONGODB for storage.

MongoDB website

Visit MongoDB

In spring boot, a self-configuring feature is also provided for such a popular mongodb.

Introducing Dependencies

Spring boot can be relied upon to pom.xml spring-boot-starter-data-mongodb introduce access support to MongoDB by adding in. Its implementation depends spring-data-mongodb . Yes, you have not read the wrong, but spring-data also the sub-project, previously introduced spring-data-jpa , spring-data-redis and for MongoDB's access to spring-data provide a strong support, the following start to try it.

<dependency>    <groupId>org.springframework.boot</groupId>    <artifactId> Spring-boot-starter-data-mongodb</artifactid></dependency>

  

Source Source

Spring Boot Tutorial (35) using the MongoDB database (1)

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.