MongoDB (c)----adding and deleting

Source: Internet
Author: User

MongoDB as a non-relational database, or the addition and deletion of the traditional database has a great difference, here is just a bit of knowledge of the sketchy, the actual use of time, we Baidu a bit more detailed usage can be. Let's look at a few big things first:




First, for the inside of the insertion and deletion is not too much to repeat, relatively less knowledge points. First look at the update, commonly used operations are very useful, we need to use flexible according to the actual situation, here just put forward the knowledge point, need to use Baidu example to learn using:




2 , the query is the same, look at the summary of knowledge points, in fact, with a few, or regular, relatively easy to record:




        3 take a look at the fixed set capped Collection: lru ( least Recently used least Recently used" rules and Insertion order age-out ( aging move out ) processing. Because of the size of the collection space, when the space is exhausted, the newly added object will replace the oldest object in the collection and always keep the most current object.

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

Usage: Store log information, the most appropriate, but cache a few 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 a mechanism for storing a binary file, for example: storing huge files such as videos, high-definition images, etc.; Gridfs Can directly take advantage of the established replication or fragmentation mechanism, which is easy to recover and extend, avoids problems with the file system where users upload content, and does not produce disk fragmentation.

GridFSusing two tables to store data, the defaultFs.files:contains metadata objects,fs.chunksa binary block that contains information about the file.    by usingbinunder the directoryMONGOFilesto operate, itsput (Storage),Get (Get)and theList(list) of three commands. It's very simple.      

All right, let's just say a little bit. MongoDB of the additions and deletions, specific operation examples did not give, time to check can, need we know these things, fixed set and large file collection, is very good idea, deserves our special attention. Suddenly think of the previous look at the picture thought series, here seems to be able to do, look at these pictures, to tell them all out can. This is almost the way to learn.



MongoDB (c)----adding and deleting

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.