MongoDB application-oriented database operations

Source: Internet
Author: User
In the previous article, the hacker has already moved on to mongodb's installation on the Windows platform, and double-click monge.exe to start data operations on the database. Insert record: [insert] Next we will create the j and t objects and save them to the test set. Insert a record (id 3 and name Max): query records

The previous blog has installed and configured mongoDB on windows. Next, double-click monge.exe to start data operations on the database. Insert record: [insert] Next we will create the j and t objects and save them to the test set. Insert a record (id 3 and name Max): query records

Zookeeper

In the previous article, the hacker has already moved on to mongodb's installation on the Windows platform, and double-click monge.exe to start data operations on the database.

Insert record: [insert]

Next we will create the j and t objects and save them to the test set.

Insert a record (id 3 and name Max ):

Query record: [find]

1. Common query:

2. Conditional query:

3. findOne ()

4. Use limit to limit the number of query result sets

Modify record: [update]

Delete record: [remove]

Create a stored procedure:

MongoDB also supports stored procedures like relational databases. The difference is that it is written in javascript and stored in the db. system. js document.

1. Create a stored procedure for addition calculation:

2. Input a parameter call to create a stored procedure:

Summary:

In addition to the data operation methods verified by the author, there are many common operations such as sort sorting, count query records, and logical operations in MongoDB.

From a series of operations above, we can see that mongoDB is unique in that it is separated from complicated SQL statements and treats each record as an object for operation. addition, deletion, modification, and query are performed by calling insert (), remove (), update (), find. This makes it easy for us to understand and use object-oriented ideas. Of course, it also has other advantages, such as the document structure to store data, improve read and write efficiency, and ensure user access speed. SoThe more you learn, the stronger you are ~~ Stayhungry, stay foolish.

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.