import pymongo
      
      # MongoDB database name
      db = client[""]
      
      # MongoDB collection name
      collection = db[""]
      
      # Insert One Document
      # `data` in the form of dictionary
      data = {
        "name": "pymongo",
        "version": "4.1.1"
      }
      
      collection.insert_one(data)

      Python language logo
      Insert Single Data - MongoDB

      Pymongo

      Add a single data to a collection in a Mongo DB.

      Shortcut: ins

      Filename pattern: *.py

      0 Comments

        Add Comment

        Log in to add a comment

        Codiga - All rights reserved 2022.