"MongoDB" MongoDB omission of knowledge points

Source: Internet
Author: User

Up to now, have seen MongoDB Books Three, today by the United States Kristina chodorow "mongodb authoritative guide" time, There is still a lot of knowledge to be missed; now make a supplement;

First, delete the speed

Deleting a document is usually quick, but if the entire collection is emptied slowly, it is faster to delete the collection directly using drop ;

Now create more than 10w of test records:

Note that with Db.tester.drop() instead of remove and findone, the speed increases but at a cost, you cannot specify any query criteria, The entire collection was removed from the mountain, and all the metadata was gone. after the Remove index these are unchanged;

Second, return array elements

It is useful to use "$slice" if you know the subscript of an element. But sometimes we want to return any one of the array elements that match the query criteria. initialize a record to illustrate the use of slice:

"MongoDB" MongoDB omission of knowledge points

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.