MongoDB (iii)--crud

Source: Internet
Author: User

MongoDB as a non-relational database. or the traditional database of the addition and deletion of the changes have a very big difference. This is just a little bit of knowledge, sketchy, practical use. We baidu a bit specific use method can.

Let's look at a few big things first:




A. Insert and delete inside are no longer too much to repeat. Relatively few knowledge points.

First look at the update, often use the operation is very practical, we need to rely on the actual situation of flexible use, here is only to put forward the knowledge point, need Baidu out sample to learn to use:




2 , the query is the same, look at the summary of knowledge points. In fact, with a few. It's still a regular one. Easier to record:




3 , take a look at the fixed set Capped Collection: as the name implies, there are fixed-size collections. The advantage is superior performance, with the LRU(Least Recently used least recently used) rule and Insertion Order Age-out ( Aging Removal ) processing.

Because the size of the collection space is certain, when the space is exhausted. The newly added object will replace the oldest object in the collection. Always keep up-to-date objects.

Features: The insertion speed of the fixed set is extremely fast; the query output is extremely fast in order of insertion, and the earliest data can be eliminated when the latest data is inserted.

How to use: Store log information, which is best for just. Cache some small number of documents ...

Create :d b.createcollection ("My_collection", {capped:true,size:100000})

Convert a normal collection to a fixed collection:db. RunCommand ({converttocapped: "Test", size:100000})

4, Large File Collection ( Grid FS ) :

Gridfs is a kind of in MongoDB the mechanism for storing the binaries in a binary file. For example: storage of huge files, such as video, high-definition pictures, etc.Gridfs will directly take advantage of the established replication or fragmentation mechanism, failure recovery and extension are very easy, to prevent users from uploading the content of the file system failure, it does not produce disk fragmentation.

GridFSusing two tables to store data, the defaultFs.files:includes metadata objects. fs.chunksa binary block that includes information about the file.    by usingbinfolder under theMONGOFilesto operate, itsput (Storage),Get (Get)and theList(list) of three commands.

It's very simple.      

All right, just a little bit . MongoDB of the additions and deletions, specific operating examples are not given, the time to check can be. Need us to know these things, fixed collections and large file collections. is a very good idea, worthy of our special attention.

Suddenly think of once looked at the picture thought series, here seems to be able to do. Look at the pictures and tell them all. This is almost the same as learning.



Copyright notice: This article Bo Master original articles, blogs, without consent may not be reproduced.

MongoDB (iii)--crud

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.