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