Python interaction with MongoDB--Update operation

Source: Internet
Author: User

Here are just a few things to discuss when Python interacts with Mongod:

1  fromPymongoImport*2 defInsert_func ():3     Try:4client_obj= Mongoclient (port=27017,host='localhost')5db =client_obj.test6         #Perform an insert operation7Db.insert_one ({'name':'Mary',' Age': 15})8         #insert more than one9Db.insert_many ([{'name':'Jimy',' Age': 18},{'name':'Alen',' Age': 20}])Ten         #Insert multiple or insert a bar can be used inert One         #Db.insert ({}) A         #Db.insert ([{},{}])

Since inserting multiple strips and inserting one can be inserted using INSERT, what Insert_one & Insert_many?

Check the source code we can see the reason:

Forgive me for the deep vision of the great God I haven't seen yet. See only one warning: insert is not recommended.

Perhaps we will find the application scenario of this design in the diversified needs of the business area.

Python interaction with MongoDB--Update operation

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.