[MongoDB] MongoDB's missing knowledge points and mongodb's missing knowledge points

Source: Internet
Author: User

[MongoDB] MongoDB's missing knowledge points and mongodb's missing knowledge points

Up to now, I have read three mongodb books. Today, when I read the MongoDB authoritative guide by Kristina Chodorow in the United States, I found that there are still many omissions in my knowledge. Now I want to make a supplement;

I. Deletion speed

Deleting a document is usually fast, but it is slow to clear the entire set. Using drop to directly Delete the set is faster;

Now we have created more than 10 million test records:

 

Use db. tester. drop () instead of remove and findone, the speed is improved but there is a cost. No query conditions can be specified. The entire set is deleted, and all metadata is lost. After removing, the indexes remain unchanged;

2. Return array elements

If you know the subscript of an element, "$ slice" is very useful. But sometimes we want to return any array element that matches the query condition. Initialize a record to describe slice usage:

 

 

 

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.