MongoDB very offal of notes

Source: Internet
Author: User

There's no 1:key inside. , and then I would prefer to handle it as a custom symbol for _DOT_.

2: Multi-use bulk operation, grammar forget to check it, in my needs I need to traverse a collection time to find that a variable is not true when the link in the document to deal with this value, After processing the variable marked as true, then this time needs to be stored enough for a certain amount of update operations, with the bulk operation to update the batch, probably this looks like, the following code, there is a need to note that a certain doc, to its built-in _id words, First take the string as the ID of the string, and then new a obejectid, you can, not directly into the string:

        Bulkwriteoperation bulkwriteoperation = mycollection.initializeunorderedbulkoperation ();          while (Mycursor.hasnext ()) {                        = mycursor.next ();             = Tempobject.get ("_id"). toString ();            System.out.println (tempstring);            Bulkwriteoperation.find (newnew ObjectId (tempstring))). Updateone (new  New basicdbobject ("Vendor", "Sigma_corporation")));                    }        Bulkwriteoperation.execute ();

3: Handling   in Web pages In Unicode form, use the following method:

        String clean_string = "";         = Dirty_string.replace ("\u00a0", "");

4:cursor can set the size of each fetch, which by default reads 101 doc into memory by batchsize

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.